mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-23 09:00:20 +08:00
refactor goctl, fix golint issues (#903)
This commit is contained in:
parent
1fb356f328
commit
69935c1ba3
@ -8,7 +8,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestUnmarshalContext(t *testing.T) {
|
func TestUnmarshalContext(t *testing.T) {
|
||||||
|
|
||||||
type Person struct {
|
type Person struct {
|
||||||
Name string `ctx:"name"`
|
Name string `ctx:"name"`
|
||||||
Age int `ctx:"age"`
|
Age int `ctx:"age"`
|
||||||
|
@ -524,7 +524,6 @@ func (u *Unmarshaler) fillSliceValue(slice reflect.Value, index int, baseKind re
|
|||||||
return errTypeMismatch
|
return errTypeMismatch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ithVal.Set(reflect.ValueOf(value))
|
ithVal.Set(reflect.ValueOf(value))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -10,17 +10,17 @@ import (
|
|||||||
|
|
||||||
const dbTag = "db"
|
const dbTag = "db"
|
||||||
|
|
||||||
// NewEq wraps builder.Eq
|
// NewEq wraps builder.Eq.
|
||||||
func NewEq(in interface{}) builder.Eq {
|
func NewEq(in interface{}) builder.Eq {
|
||||||
return builder.Eq(ToMap(in))
|
return builder.Eq(ToMap(in))
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGt wraps builder.Gt
|
// NewGt wraps builder.Gt.
|
||||||
func NewGt(in interface{}) builder.Gt {
|
func NewGt(in interface{}) builder.Gt {
|
||||||
return builder.Gt(ToMap(in))
|
return builder.Gt(ToMap(in))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToMap converts interface into map
|
// ToMap converts interface into map.
|
||||||
func ToMap(in interface{}) map[string]interface{} {
|
func ToMap(in interface{}) map[string]interface{} {
|
||||||
out := make(map[string]interface{})
|
out := make(map[string]interface{})
|
||||||
v := reflect.ValueOf(in)
|
v := reflect.ValueOf(in)
|
||||||
@ -81,7 +81,7 @@ func FieldNames(in interface{}) []string {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// RawFieldNames converts golang struct field into slice string
|
// RawFieldNames converts golang struct field into slice string.
|
||||||
func RawFieldNames(in interface{}, postgresSql ...bool) []string {
|
func RawFieldNames(in interface{}, postgresSql ...bool) []string {
|
||||||
out := make([]string, 0)
|
out := make([]string, 0)
|
||||||
v := reflect.ValueOf(in)
|
v := reflect.ValueOf(in)
|
||||||
@ -121,7 +121,7 @@ func RawFieldNames(in interface{}, postgresSql ...bool) []string {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
//PostgreSqlJoin concatenate the given elements into a string
|
// PostgreSqlJoin concatenates the given elements into a string.
|
||||||
func PostgreSqlJoin(elems []string) string {
|
func PostgreSqlJoin(elems []string) string {
|
||||||
b := new(strings.Builder)
|
b := new(strings.Builder)
|
||||||
for index, e := range elems {
|
for index, e := range elems {
|
||||||
|
Loading…
Reference in New Issue
Block a user