chore: remove unused code

GitOrigin-RevId: 98ba0a49ce987b84a408c0dab921fa97d2d1e9d7
This commit is contained in:
Philippe Gaultier 2025-12-02 12:38:24 +01:00 committed by ory-bot
parent 1f4b512abf
commit e8586df28d
8 changed files with 0 additions and 138 deletions

View File

@ -32,13 +32,6 @@ type (
TLACodes, TLAVars, ExtCodes, ExtVars []kv
}
ProcessVM struct {
ctx context.Context
path string
args []string
params processParameters
}
vmOptions struct {
jsonnetBinaryPath string
args []string

View File

@ -28,7 +28,6 @@ type Middleware struct {
o *middlewareOptions
wku string
jm *jwtmiddleware.JWTMiddleware
w herodot.Writer
}
type middlewareOptions struct {

View File

@ -81,15 +81,6 @@ func GetTime[K comparable](values map[K]any, key K) (time.Time, error) {
return time.Time{}, ErrKeyCanNotBeTypeAsserted
}
// GetInt64Default returns a int64 or the default value for a given key in values.
func GetInt64Default[K comparable](values map[K]any, key K, defaultValue int64) int64 {
f, err := GetInt64(values, key)
if err != nil {
return defaultValue
}
return f
}
// GetInt64 returns an int64 for a given key in values.
func GetInt64[K comparable](values map[K]any, key K) (int64, error) {
v, ok := values[key]
@ -122,15 +113,6 @@ func GetInt64[K comparable](values map[K]any, key K) (int64, error) {
return 0, ErrKeyCanNotBeTypeAsserted
}
// GetInt32Default returns a int32 or the default value for a given key in values.
func GetInt32Default[K comparable](values map[K]any, key K, defaultValue int32) int32 {
f, err := GetInt32(values, key)
if err != nil {
return defaultValue
}
return f
}
// GetInt32 returns an int32 for a given key in values.
func GetInt32[K comparable](values map[K]any, key K) (int32, error) {
v, err := GetInt64(values, key)
@ -143,15 +125,6 @@ func GetInt32[K comparable](values map[K]any, key K) (int32, error) {
return int32(v), nil
}
// GetIntDefault returns a int or the default value for a given key in values.
func GetIntDefault[K comparable](values map[K]any, key K, defaultValue int) int {
f, err := GetInt(values, key)
if err != nil {
return defaultValue
}
return f
}
// GetInt returns an int for a given key in values.
func GetInt[K comparable](values map[K]any, key K) (int, error) {
v, err := GetInt64(values, key)
@ -164,33 +137,6 @@ func GetInt[K comparable](values map[K]any, key K) (int, error) {
return int(v), nil
}
// GetFloat32Default returns a float32 or the default value for a given key in values.
func GetFloat32Default[K comparable](values map[K]any, key K, defaultValue float32) float32 {
f, err := GetFloat32(values, key)
if err != nil {
return defaultValue
}
return f
}
// GetFloat32 returns a float32 for a given key in values.
func GetFloat32[K comparable](values map[K]any, key K) (float32, error) {
v, ok := values[key]
if !ok {
return 0, ErrKeyDoesNotExist
}
switch v := v.(type) {
case json.Number:
f, err := v.Float64()
return float32(f), err
case float32:
return v, nil
case float64:
return float32(v), nil
}
return 0, ErrKeyCanNotBeTypeAsserted
}
// GetFloat64Default returns a float64 or the default value for a given key in values.
func GetFloat64Default[K comparable](values map[K]any, key K, defaultValue float64) float64 {
f, err := GetFloat64(values, key)

View File

@ -52,7 +52,3 @@ func NullStringer(k string, v fmt.Stringer) attribute.KeyValue {
}
return attribute.String(k, v.String())
}
func NullInt[I int | int32 | int64, V *I | sql.Null[I]](k string, v V) attribute.KeyValue {
return Nullable[I](AutoInt, k, v)
}

View File

@ -101,8 +101,6 @@ type tracerProvider struct {
t trace.Tracer
}
func (tp tracerProvider) tracerProvider() {}
var _ trace.TracerProvider = tracerProvider{}
// Tracer implements trace.TracerProvider.

View File

@ -22,14 +22,6 @@ func IndexHint(conn *pop.Connection, table string, index string) string {
return table
}
func WritableDBColumnNames[T any]() []string {
var names []string
for _, c := range (&pop.Model{Value: new(T)}).Columns().Writeable().Cols {
names = append(names, c.Name)
}
return names
}
func DBColumnsExcluding[T any](quoter Quoter, exclude ...string) string {
cols := (&pop.Model{Value: new(T)}).Columns()
for _, e := range exclude {

View File

@ -10,43 +10,9 @@ import (
"slices"
"strings"
"github.com/jmoiron/sqlx/reflectx"
"github.com/pkg/errors"
)
// GetDBFieldNames extracts all database field names from a struct based on the `db` tags using sqlx.
// Fields without a `db` tag, with a `db:"-"` tag, or listed in the `exclude` parameter are omitted.
// Returns a slice of field names as strings.
//
// type Simple struct {
// Foo string `db:"foo"`
// Bar string `db:"bar"`
// Baz string `db:"baz"`
// Baz string `db:"-"` // Excluded due to "-" tag
// Qux string // Excluded due to missing db tag
// }
//
// fields := GetDBFieldNames[Simple](true, []string{"baz"})
// // Returns: ["foo", "bar"]
func GetDBFieldNames[M any](strict bool, excludeColumns []string) []string {
// Create a mapper that uses the "db" tag
mapper := reflectx.NewMapper("db")
// Get field names from the structs
fields := mapper.TypeMap(reflectx.Deref(reflect.TypeOf((*M)(nil)))).Names
// Extract just the field names
fieldNames := make([]string, 0, len(fields))
for _, f := range fields {
if (strict && f.Field.Tag == "") || f.Path == "" || f.Name == "" || slices.Contains(excludeColumns, f.Name) {
continue
}
fieldNames = append(fieldNames, f.Name)
}
return fieldNames
}
func keys(t any, exclude []string) []string {
tt := reflect.TypeOf(t)
if tt.Kind() == reflect.Pointer {

View File

@ -8,8 +8,6 @@ import (
"encoding/json"
"fmt"
"io"
"github.com/pkg/errors"
)
type (
@ -55,8 +53,6 @@ const (
serialTypeError serialEventType = "error"
)
var errUnknownEvent = errors.New("unknown event type")
func (e *ErrorEvent) Reader() io.Reader {
return bytes.NewBufferString(e.Error())
}
@ -111,27 +107,3 @@ func (e *RemoveEvent) MarshalJSON() ([]byte, error) {
func (e *RemoveEvent) String() string {
return fmt.Sprintf("removed source: %s", e.source)
}
func unmarshalEvent(data []byte) (Event, error) {
var serialEvent serialEvent
if err := json.Unmarshal(data, &serialEvent); err != nil {
return nil, errors.WithStack(err)
}
switch serialEvent.Type {
case serialTypeRemove:
return &RemoveEvent{
source: serialEvent.Source,
}, nil
case serialTypeChange:
return &ChangeEvent{
data: serialEvent.Data,
source: serialEvent.Source,
}, nil
case serialTypeError:
return &ErrorEvent{
error: errors.New(string(serialEvent.Data)),
source: serialEvent.Source,
}, nil
}
return nil, errUnknownEvent
}