WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit c90675c

Browse files
gaultierory-bot
authored andcommitted
chore: remove unused code
GitOrigin-RevId: 98ba0a49ce987b84a408c0dab921fa97d2d1e9d7
1 parent 6673982 commit c90675c

File tree

8 files changed

+0
-138
lines changed

8 files changed

+0
-138
lines changed

oryx/jsonnetsecure/jsonnet.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ type (
3232
TLACodes, TLAVars, ExtCodes, ExtVars []kv
3333
}
3434

35-
ProcessVM struct {
36-
ctx context.Context
37-
path string
38-
args []string
39-
params processParameters
40-
}
41-
4235
vmOptions struct {
4336
jsonnetBinaryPath string
4437
args []string

oryx/jwtmiddleware/middleware.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ type Middleware struct {
2828
o *middlewareOptions
2929
wku string
3030
jm *jwtmiddleware.JWTMiddleware
31-
w herodot.Writer
3231
}
3332

3433
type middlewareOptions struct {

oryx/mapx/type_assert.go

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,6 @@ func GetTime[K comparable](values map[K]any, key K) (time.Time, error) {
8181
return time.Time{}, ErrKeyCanNotBeTypeAsserted
8282
}
8383

84-
// GetInt64Default returns a int64 or the default value for a given key in values.
85-
func GetInt64Default[K comparable](values map[K]any, key K, defaultValue int64) int64 {
86-
f, err := GetInt64(values, key)
87-
if err != nil {
88-
return defaultValue
89-
}
90-
return f
91-
}
92-
9384
// GetInt64 returns an int64 for a given key in values.
9485
func GetInt64[K comparable](values map[K]any, key K) (int64, error) {
9586
v, ok := values[key]
@@ -122,15 +113,6 @@ func GetInt64[K comparable](values map[K]any, key K) (int64, error) {
122113
return 0, ErrKeyCanNotBeTypeAsserted
123114
}
124115

125-
// GetInt32Default returns a int32 or the default value for a given key in values.
126-
func GetInt32Default[K comparable](values map[K]any, key K, defaultValue int32) int32 {
127-
f, err := GetInt32(values, key)
128-
if err != nil {
129-
return defaultValue
130-
}
131-
return f
132-
}
133-
134116
// GetInt32 returns an int32 for a given key in values.
135117
func GetInt32[K comparable](values map[K]any, key K) (int32, error) {
136118
v, err := GetInt64(values, key)
@@ -143,15 +125,6 @@ func GetInt32[K comparable](values map[K]any, key K) (int32, error) {
143125
return int32(v), nil
144126
}
145127

146-
// GetIntDefault returns a int or the default value for a given key in values.
147-
func GetIntDefault[K comparable](values map[K]any, key K, defaultValue int) int {
148-
f, err := GetInt(values, key)
149-
if err != nil {
150-
return defaultValue
151-
}
152-
return f
153-
}
154-
155128
// GetInt returns an int for a given key in values.
156129
func GetInt[K comparable](values map[K]any, key K) (int, error) {
157130
v, err := GetInt64(values, key)
@@ -164,33 +137,6 @@ func GetInt[K comparable](values map[K]any, key K) (int, error) {
164137
return int(v), nil
165138
}
166139

167-
// GetFloat32Default returns a float32 or the default value for a given key in values.
168-
func GetFloat32Default[K comparable](values map[K]any, key K, defaultValue float32) float32 {
169-
f, err := GetFloat32(values, key)
170-
if err != nil {
171-
return defaultValue
172-
}
173-
return f
174-
}
175-
176-
// GetFloat32 returns a float32 for a given key in values.
177-
func GetFloat32[K comparable](values map[K]any, key K) (float32, error) {
178-
v, ok := values[key]
179-
if !ok {
180-
return 0, ErrKeyDoesNotExist
181-
}
182-
switch v := v.(type) {
183-
case json.Number:
184-
f, err := v.Float64()
185-
return float32(f), err
186-
case float32:
187-
return v, nil
188-
case float64:
189-
return float32(v), nil
190-
}
191-
return 0, ErrKeyCanNotBeTypeAsserted
192-
}
193-
194140
// GetFloat64Default returns a float64 or the default value for a given key in values.
195141
func GetFloat64Default[K comparable](values map[K]any, key K, defaultValue float64) float64 {
196142
f, err := GetFloat64(values, key)

oryx/otelx/attribute.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,3 @@ func NullStringer(k string, v fmt.Stringer) attribute.KeyValue {
5252
}
5353
return attribute.String(k, v.String())
5454
}
55-
56-
func NullInt[I int | int32 | int64, V *I | sql.Null[I]](k string, v V) attribute.KeyValue {
57-
return Nullable[I](AutoInt, k, v)
58-
}

oryx/otelx/otel.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ type tracerProvider struct {
101101
t trace.Tracer
102102
}
103103

104-
func (tp tracerProvider) tracerProvider() {}
105-
106104
var _ trace.TracerProvider = tracerProvider{}
107105

108106
// Tracer implements trace.TracerProvider.

oryx/popx/db_columns.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ func IndexHint(conn *pop.Connection, table string, index string) string {
2222
return table
2323
}
2424

25-
func WritableDBColumnNames[T any]() []string {
26-
var names []string
27-
for _, c := range (&pop.Model{Value: new(T)}).Columns().Writeable().Cols {
28-
names = append(names, c.Name)
29-
}
30-
return names
31-
}
32-
3325
func DBColumnsExcluding[T any](quoter Quoter, exclude ...string) string {
3426
cols := (&pop.Model{Value: new(T)}).Columns()
3527
for _, e := range exclude {

oryx/sqlxx/sqlxx.go

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,9 @@ import (
1010
"slices"
1111
"strings"
1212

13-
"github.com/jmoiron/sqlx/reflectx"
1413
"github.com/pkg/errors"
1514
)
1615

17-
// GetDBFieldNames extracts all database field names from a struct based on the `db` tags using sqlx.
18-
// Fields without a `db` tag, with a `db:"-"` tag, or listed in the `exclude` parameter are omitted.
19-
// Returns a slice of field names as strings.
20-
//
21-
// type Simple struct {
22-
// Foo string `db:"foo"`
23-
// Bar string `db:"bar"`
24-
// Baz string `db:"baz"`
25-
// Baz string `db:"-"` // Excluded due to "-" tag
26-
// Qux string // Excluded due to missing db tag
27-
// }
28-
//
29-
// fields := GetDBFieldNames[Simple](true, []string{"baz"})
30-
// // Returns: ["foo", "bar"]
31-
func GetDBFieldNames[M any](strict bool, excludeColumns []string) []string {
32-
// Create a mapper that uses the "db" tag
33-
mapper := reflectx.NewMapper("db")
34-
35-
// Get field names from the structs
36-
fields := mapper.TypeMap(reflectx.Deref(reflect.TypeOf((*M)(nil)))).Names
37-
38-
// Extract just the field names
39-
fieldNames := make([]string, 0, len(fields))
40-
for _, f := range fields {
41-
if (strict && f.Field.Tag == "") || f.Path == "" || f.Name == "" || slices.Contains(excludeColumns, f.Name) {
42-
continue
43-
}
44-
fieldNames = append(fieldNames, f.Name)
45-
}
46-
47-
return fieldNames
48-
}
49-
5016
func keys(t any, exclude []string) []string {
5117
tt := reflect.TypeOf(t)
5218
if tt.Kind() == reflect.Pointer {

oryx/watcherx/event.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import (
88
"encoding/json"
99
"fmt"
1010
"io"
11-
12-
"github.com/pkg/errors"
1311
)
1412

1513
type (
@@ -55,8 +53,6 @@ const (
5553
serialTypeError serialEventType = "error"
5654
)
5755

58-
var errUnknownEvent = errors.New("unknown event type")
59-
6056
func (e *ErrorEvent) Reader() io.Reader {
6157
return bytes.NewBufferString(e.Error())
6258
}
@@ -111,27 +107,3 @@ func (e *RemoveEvent) MarshalJSON() ([]byte, error) {
111107
func (e *RemoveEvent) String() string {
112108
return fmt.Sprintf("removed source: %s", e.source)
113109
}
114-
115-
func unmarshalEvent(data []byte) (Event, error) {
116-
var serialEvent serialEvent
117-
if err := json.Unmarshal(data, &serialEvent); err != nil {
118-
return nil, errors.WithStack(err)
119-
}
120-
switch serialEvent.Type {
121-
case serialTypeRemove:
122-
return &RemoveEvent{
123-
source: serialEvent.Source,
124-
}, nil
125-
case serialTypeChange:
126-
return &ChangeEvent{
127-
data: serialEvent.Data,
128-
source: serialEvent.Source,
129-
}, nil
130-
case serialTypeError:
131-
return &ErrorEvent{
132-
error: errors.New(string(serialEvent.Data)),
133-
source: serialEvent.Source,
134-
}, nil
135-
}
136-
return nil, errUnknownEvent
137-
}

0 commit comments

Comments
 (0)