|
@@ -739,15 +739,18 @@ type AssignTagFromSlice struct {
|
|
MapSliceField []map[string]string `assign:"toField:MapSliceField"`
|
|
MapSliceField []map[string]string `assign:"toField:MapSliceField"`
|
|
ChanSliceField []chan any `assign:"toField:ChanSliceField"`
|
|
ChanSliceField []chan any `assign:"toField:ChanSliceField"`
|
|
FuncSliceField []func() string `assign:"toField:FuncSliceField"`
|
|
FuncSliceField []func() string `assign:"toField:FuncSliceField"`
|
|
|
|
+ FromStringSliceToStringField []string `assign:"toField:FromStringSliceToStringField"`
|
|
|
|
+ FromTimeToStringField []time.Time `assign:"toField:FromTimeToStringField"`
|
|
|
|
+ FromStringToTimeField []string `assign:"toField:FromStringToTimeField"`
|
|
BasicPointerSliceField []*string `assign:"toField:BasicPointerSliceField"`
|
|
BasicPointerSliceField []*string `assign:"toField:BasicPointerSliceField"`
|
|
TimePointerSliceField []*time.Time `assign:"toField:TimePointerSliceField"`
|
|
TimePointerSliceField []*time.Time `assign:"toField:TimePointerSliceField"`
|
|
StructPointerSliceField []*AssignTagFrom `assign:"toField:StructPointerSliceField"`
|
|
StructPointerSliceField []*AssignTagFrom `assign:"toField:StructPointerSliceField"`
|
|
MapPointerSliceField []*map[string]string `assign:"toField:MapPointerSliceField"`
|
|
MapPointerSliceField []*map[string]string `assign:"toField:MapPointerSliceField"`
|
|
ChanPointerSliceField []*chan any `assign:"toField:ChanPointerSliceField"`
|
|
ChanPointerSliceField []*chan any `assign:"toField:ChanPointerSliceField"`
|
|
FuncPointerSliceField []*func() string `assign:"toField:FuncPointerSliceField"`
|
|
FuncPointerSliceField []*func() string `assign:"toField:FuncPointerSliceField"`
|
|
- FromStringSliceToStringField []string `assign:"toField:FromStringSliceToStringField"`
|
|
|
|
- FromTimeToStringField []time.Time `assign:"toField:FromTimeToStringField"`
|
|
|
|
- FromStringToTimeField []string `assign:"toField:FromStringToTimeField"`
|
|
|
|
|
|
+ //FromStringSliceToStringPointerField []*string `assign:"toField:FromStringSliceToStringPointerField"`
|
|
|
|
+ //FromTimeToStringPointerField []*time.Time `assign:"toField:FromTimeToStringPointerField"`
|
|
|
|
+ //FromStringToTimePointerField []*string `assign:"toField:FromStringToTimePointerField"`
|
|
}
|
|
}
|
|
|
|
|
|
type AssignTagFromSlicePointerField struct {
|
|
type AssignTagFromSlicePointerField struct {
|
|
@@ -758,15 +761,18 @@ type AssignTagFromSlicePointerField struct {
|
|
MapSliceField *[]map[string]string `assign:"toField:MapSliceField"`
|
|
MapSliceField *[]map[string]string `assign:"toField:MapSliceField"`
|
|
ChanSliceField *[]chan any `assign:"toField:ChanSliceField"`
|
|
ChanSliceField *[]chan any `assign:"toField:ChanSliceField"`
|
|
FuncSliceField *[]func() string `assign:"toField:FuncSliceField"`
|
|
FuncSliceField *[]func() string `assign:"toField:FuncSliceField"`
|
|
|
|
+ FromStringSliceToStringField *[]string `assign:"toField:FromStringSliceToStringField"`
|
|
|
|
+ FromTimeToStringField *[]time.Time `assign:"toField:FromTimeToStringField"`
|
|
|
|
+ FromStringToTimeField *[]string `assign:"toField:FromStringToTimeField"`
|
|
BasicPointerSliceField *[]*string `assign:"toField:BasicPointerSliceField"`
|
|
BasicPointerSliceField *[]*string `assign:"toField:BasicPointerSliceField"`
|
|
TimePointerSliceField *[]*time.Time `assign:"toField:TimePointerSliceField"`
|
|
TimePointerSliceField *[]*time.Time `assign:"toField:TimePointerSliceField"`
|
|
StructPointerSliceField *[]*AssignTagFrom `assign:"toField:StructPointerSliceField"`
|
|
StructPointerSliceField *[]*AssignTagFrom `assign:"toField:StructPointerSliceField"`
|
|
MapPointerSliceField *[]*map[string]string `assign:"toField:MapPointerSliceField"`
|
|
MapPointerSliceField *[]*map[string]string `assign:"toField:MapPointerSliceField"`
|
|
ChanPointerSliceField *[]*chan any `assign:"toField:ChanPointerSliceField"`
|
|
ChanPointerSliceField *[]*chan any `assign:"toField:ChanPointerSliceField"`
|
|
FuncPointerSliceField *[]*func() string `assign:"toField:FuncPointerSliceField"`
|
|
FuncPointerSliceField *[]*func() string `assign:"toField:FuncPointerSliceField"`
|
|
- FromStringSliceToStringField *[]string `assign:"toField:FromStringSliceToStringField"`
|
|
|
|
- FromTimeToStringField *[]time.Time `assign:"toField:FromTimeToStringField"`
|
|
|
|
- FromStringToTimeField *[]string `assign:"toField:FromStringToTimeField"`
|
|
|
|
|
|
+ //FromStringSliceToStringPointerField *[]*string `assign:"toField:FromStringSliceToStringPointerField"`
|
|
|
|
+ //FromTimeToStringPointerField *[]*time.Time `assign:"toField:FromTimeToStringPointerField"`
|
|
|
|
+ //FromStringToTimePointerField *[]*string `assign:"toField:FromStringToTimePointerField"`
|
|
}
|
|
}
|
|
|
|
|
|
type AssignTagToSlice struct {
|
|
type AssignTagToSlice struct {
|
|
@@ -777,15 +783,18 @@ type AssignTagToSlice struct {
|
|
MapSliceField []map[string]string
|
|
MapSliceField []map[string]string
|
|
ChanSliceField []chan any
|
|
ChanSliceField []chan any
|
|
FuncSliceField []func() string
|
|
FuncSliceField []func() string
|
|
|
|
+ FromStringSliceToStringField string
|
|
|
|
+ FromTimeToStringField []string
|
|
|
|
+ FromStringToTimeField []time.Time
|
|
BasicPointerSliceField []*string
|
|
BasicPointerSliceField []*string
|
|
TimePointerSliceField []*time.Time
|
|
TimePointerSliceField []*time.Time
|
|
StructPointerSliceField []*AssignTagTo
|
|
StructPointerSliceField []*AssignTagTo
|
|
MapPointerSliceField []*map[string]string
|
|
MapPointerSliceField []*map[string]string
|
|
ChanPointerSliceField []*chan any
|
|
ChanPointerSliceField []*chan any
|
|
FuncPointerSliceField []*func() string
|
|
FuncPointerSliceField []*func() string
|
|
- FromStringSliceToStringField string
|
|
|
|
- FromTimeToStringField []string
|
|
|
|
- FromStringToTimeField []time.Time
|
|
|
|
|
|
+ //FromStringSliceToStringPointerField string
|
|
|
|
+ //FromTimeToStringPointerField []*string
|
|
|
|
+ //FromStringToTimePointerField []*time.Time
|
|
}
|
|
}
|
|
|
|
|
|
func (to AssignTagToSlice) checkFields(t *testing.T, from AssignTagFromSlice) {
|
|
func (to AssignTagToSlice) checkFields(t *testing.T, from AssignTagFromSlice) {
|
|
@@ -835,6 +844,25 @@ func (to AssignTagToSlice) checkFields(t *testing.T, from AssignTagFromSlice) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if strings.Join(from.FromStringSliceToStringField, "::") != to.FromStringSliceToStringField {
|
|
|
|
+ t.Fatalf("%+v\n", errors.Errorf("FromStringSliceToStringField not equal: from %v, to %v",
|
|
|
|
+ strings.Join(from.FromStringSliceToStringField, "::"), to.FromStringSliceToStringField))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for i, value := range from.FromTimeToStringField {
|
|
|
|
+ if value.Format(time.DateTime) != to.FromTimeToStringField[i] {
|
|
|
|
+ t.Fatalf("%+v\n", errors.Errorf("FromTimeToStringField not equal: from %v, to %v",
|
|
|
|
+ value.Format(time.DateTime), to.FromTimeToStringField[i]))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for i, value := range from.FromStringToTimeField {
|
|
|
|
+ if value != to.FromStringToTimeField[i].Format(time.DateTime) {
|
|
|
|
+ t.Fatalf("%+v\n", errors.Errorf("FromStringToTimeField not equal: from %v, to %v",
|
|
|
|
+ value, to.FromStringToTimeField[i].Format(time.DateTime)))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
for i, value := range from.BasicPointerSliceField {
|
|
for i, value := range from.BasicPointerSliceField {
|
|
if *value != *to.BasicPointerSliceField[i] {
|
|
if *value != *to.BasicPointerSliceField[i] {
|
|
t.Fatalf("%+v\n", errors.Errorf("BasicPointerSliceField not equal: from %v, to %v",
|
|
t.Fatalf("%+v\n", errors.Errorf("BasicPointerSliceField not equal: from %v, to %v",
|
|
@@ -875,18 +903,6 @@ func (to AssignTagToSlice) checkFields(t *testing.T, from AssignTagFromSlice) {
|
|
(*value)(), (*to.FuncPointerSliceField[i])()))
|
|
(*value)(), (*to.FuncPointerSliceField[i])()))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- if strings.Join(from.FromStringSliceToStringField, "::") != to.FromStringSliceToStringField {
|
|
|
|
- t.Fatalf("%+v\n", errors.Errorf("FromStringSliceToStringField not equal: from %v, to %v",
|
|
|
|
- strings.Join(from.FromStringSliceToStringField, "::"), to.FromStringSliceToStringField))
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- for i, value := range from.FromTimeToStringField {
|
|
|
|
- if value.Format(time.DateTime) != to.FromTimeToStringField[i] {
|
|
|
|
- t.Fatalf("%+v\n", errors.Errorf("FromTimeToStringField not equal: from %v, to %v",
|
|
|
|
- value.Format(time.DateTime), to.FromTimeToStringField))
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
func (to AssignTagToSlice) checkNil(t *testing.T) {
|
|
func (to AssignTagToSlice) checkNil(t *testing.T) {
|
|
@@ -918,6 +934,18 @@ func (to AssignTagToSlice) checkNil(t *testing.T) {
|
|
t.Fatalf("%+v\n", errors.Errorf("FuncSliceField not nil"))
|
|
t.Fatalf("%+v\n", errors.Errorf("FuncSliceField not nil"))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if to.FromStringSliceToStringField != "" {
|
|
|
|
+ t.Fatalf("%+v\n", errors.Errorf("FromStringSliceToStringField not zero"))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if to.FromTimeToStringField != nil {
|
|
|
|
+ t.Fatalf("%+v\n", errors.Errorf("FromTimeToStringField not nil"))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if to.FromStringToTimeField != nil {
|
|
|
|
+ t.Fatalf("%+v\n", errors.Errorf("FromStringToTimeField not nil"))
|
|
|
|
+ }
|
|
|
|
+
|
|
if to.BasicPointerSliceField != nil {
|
|
if to.BasicPointerSliceField != nil {
|
|
t.Fatalf("%+v\n", errors.Errorf("BasicPointerSliceField not nil"))
|
|
t.Fatalf("%+v\n", errors.Errorf("BasicPointerSliceField not nil"))
|
|
}
|
|
}
|
|
@@ -941,14 +969,6 @@ func (to AssignTagToSlice) checkNil(t *testing.T) {
|
|
if to.FuncPointerSliceField != nil {
|
|
if to.FuncPointerSliceField != nil {
|
|
t.Fatalf("%+v\n", errors.Errorf("FuncPointerSliceField not nil"))
|
|
t.Fatalf("%+v\n", errors.Errorf("FuncPointerSliceField not nil"))
|
|
}
|
|
}
|
|
-
|
|
|
|
- if to.FromStringSliceToStringField != "" {
|
|
|
|
- t.Fatalf("%+v\n", errors.Errorf("FromStringSliceToStringField not zero"))
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if to.FromTimeToStringField != nil {
|
|
|
|
- t.Fatalf("%+v\n", errors.Errorf("FromTimeToStringField not nil"))
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
type AssignTagToSlicePointerField struct {
|
|
type AssignTagToSlicePointerField struct {
|
|
@@ -959,15 +979,18 @@ type AssignTagToSlicePointerField struct {
|
|
MapSliceField *[]map[string]string
|
|
MapSliceField *[]map[string]string
|
|
ChanSliceField *[]chan any
|
|
ChanSliceField *[]chan any
|
|
FuncSliceField *[]func() string
|
|
FuncSliceField *[]func() string
|
|
|
|
+ FromStringSliceToStringField *string
|
|
|
|
+ FromTimeToStringField *[]string
|
|
|
|
+ FromStringToTimeField *[]time.Time
|
|
BasicPointerSliceField *[]*string
|
|
BasicPointerSliceField *[]*string
|
|
TimePointerSliceField *[]*time.Time
|
|
TimePointerSliceField *[]*time.Time
|
|
StructPointerSliceField *[]*AssignTagTo
|
|
StructPointerSliceField *[]*AssignTagTo
|
|
MapPointerSliceField *[]*map[string]string
|
|
MapPointerSliceField *[]*map[string]string
|
|
ChanPointerSliceField *[]*chan any
|
|
ChanPointerSliceField *[]*chan any
|
|
FuncPointerSliceField *[]*func() string
|
|
FuncPointerSliceField *[]*func() string
|
|
- FromStringSliceToStringField *string
|
|
|
|
- FromTimeToStringField *[]string
|
|
|
|
- FromStringToTimeField []time.Time
|
|
|
|
|
|
+ //FromStringSliceToStringPointerField *string
|
|
|
|
+ //FromTimeToStringPointerField *[]*string
|
|
|
|
+ //FromStringToTimePointerField *[]*time.Time
|
|
}
|
|
}
|
|
|
|
|
|
func (to AssignTagToSlicePointerField) checkFields(t *testing.T, from AssignTagFromSlice) {
|
|
func (to AssignTagToSlicePointerField) checkFields(t *testing.T, from AssignTagFromSlice) {
|
|
@@ -1017,6 +1040,25 @@ func (to AssignTagToSlicePointerField) checkFields(t *testing.T, from AssignTagF
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if strings.Join(from.FromStringSliceToStringField, "::") != *to.FromStringSliceToStringField {
|
|
|
|
+ t.Fatalf("%+v\n", errors.Errorf("FromStringSliceToStringField not equal: from %v, to %v",
|
|
|
|
+ strings.Join(from.FromStringSliceToStringField, "::"), *to.FromStringSliceToStringField))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for i, value := range from.FromTimeToStringField {
|
|
|
|
+ if value.Format(time.DateTime) != (*to.FromTimeToStringField)[i] {
|
|
|
|
+ t.Fatalf("%+v\n", errors.Errorf("FromTimeToStringField not equal: from %v, to %v",
|
|
|
|
+ value.Format(time.DateTime), (*to.FromTimeToStringField)[i]))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for i, value := range from.FromStringToTimeField {
|
|
|
|
+ if value != (*to.FromStringToTimeField)[i].Format(time.DateTime) {
|
|
|
|
+ t.Fatalf("%+v\n", errors.Errorf("FromStringToTimeField not equal: from %v, to %v",
|
|
|
|
+ value, (*to.FromStringToTimeField)[i].Format(time.DateTime)))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
for i, value := range from.BasicPointerSliceField {
|
|
for i, value := range from.BasicPointerSliceField {
|
|
if *value != *(*to.BasicPointerSliceField)[i] {
|
|
if *value != *(*to.BasicPointerSliceField)[i] {
|
|
t.Fatalf("%+v\n", errors.Errorf("BasicPointerSliceField not equal: from %v, to %v",
|
|
t.Fatalf("%+v\n", errors.Errorf("BasicPointerSliceField not equal: from %v, to %v",
|
|
@@ -1057,18 +1099,6 @@ func (to AssignTagToSlicePointerField) checkFields(t *testing.T, from AssignTagF
|
|
(*value)(), (*(*to.FuncPointerSliceField)[i])()))
|
|
(*value)(), (*(*to.FuncPointerSliceField)[i])()))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- if strings.Join(from.FromStringSliceToStringField, "::") != *to.FromStringSliceToStringField {
|
|
|
|
- t.Fatalf("%+v\n", errors.Errorf("FromStringSliceToStringField not equal: from %v, to %v",
|
|
|
|
- strings.Join(from.FromStringSliceToStringField, "::"), *to.FromStringSliceToStringField))
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- for i, value := range from.FromTimeToStringField {
|
|
|
|
- if value.Format(time.DateTime) != (*to.FromTimeToStringField)[i] {
|
|
|
|
- t.Fatalf("%+v\n", errors.Errorf("FromTimeToStringField not equal: from %v, to %v",
|
|
|
|
- value.Format(time.DateTime), to.FromTimeToStringField))
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
func (to AssignTagToSlicePointerField) checkNil(t *testing.T) {
|
|
func (to AssignTagToSlicePointerField) checkNil(t *testing.T) {
|
|
@@ -1100,6 +1130,18 @@ func (to AssignTagToSlicePointerField) checkNil(t *testing.T) {
|
|
t.Fatalf("%+v\n", errors.Errorf("FuncSliceField not nil"))
|
|
t.Fatalf("%+v\n", errors.Errorf("FuncSliceField not nil"))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if to.FromStringSliceToStringField != nil {
|
|
|
|
+ t.Fatalf("%+v\n", errors.Errorf("FromStringSliceToStringField not nil"))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if to.FromTimeToStringField != nil {
|
|
|
|
+ t.Fatalf("%+v\n", errors.Errorf("FromTimeToStringField not nil"))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if to.FromStringToTimeField != nil {
|
|
|
|
+ t.Fatalf("%+v\n", errors.Errorf("FromStringToTimeField not nil"))
|
|
|
|
+ }
|
|
|
|
+
|
|
if to.BasicPointerSliceField != nil {
|
|
if to.BasicPointerSliceField != nil {
|
|
t.Fatalf("%+v\n", errors.Errorf("BasicPointerSliceField not nil"))
|
|
t.Fatalf("%+v\n", errors.Errorf("BasicPointerSliceField not nil"))
|
|
}
|
|
}
|
|
@@ -1123,14 +1165,6 @@ func (to AssignTagToSlicePointerField) checkNil(t *testing.T) {
|
|
if to.FuncPointerSliceField != nil {
|
|
if to.FuncPointerSliceField != nil {
|
|
t.Fatalf("%+v\n", errors.Errorf("FuncPointerSliceField not nil"))
|
|
t.Fatalf("%+v\n", errors.Errorf("FuncPointerSliceField not nil"))
|
|
}
|
|
}
|
|
-
|
|
|
|
- if to.FromStringSliceToStringField != nil {
|
|
|
|
- t.Fatalf("%+v\n", errors.Errorf("FromStringSliceToStringField not nil"))
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if to.FromTimeToStringField != nil {
|
|
|
|
- t.Fatalf("%+v\n", errors.Errorf("FromTimeToStringField not nil"))
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
func TestAssignTagDefaultUsageSlice(t *testing.T) {
|
|
func TestAssignTagDefaultUsageSlice(t *testing.T) {
|