- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for ConvertMapToValuesForCreate (0.17 sec)
-
callbacks/helper.go
package callbacks import ( "reflect" "sort" "gorm.io/gorm" "gorm.io/gorm/clause" ) // ConvertMapToValuesForCreate convert map to values func ConvertMapToValuesForCreate(stmt *gorm.Statement, mapValue map[string]interface{}) (values clause.Values) { values.Columns = make([]clause.Column, 0, len(mapValue)) selectColumns, restricted := stmt.SelectAndOmitColumns(true, false) keys := make([]string, 0, len(mapValue))
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Apr 14 12:32:57 UTC 2022 - 3.7K bytes - Viewed (0) -
callbacks/helper_test.go
Columns: []clause.Column{{Name: "active"}}, Values: [][]interface{}{{true}}, }, }, } for _, tc := range testCase { t.Run(tc.name, func(t *testing.T) { actual := ConvertMapToValuesForCreate(&gorm.Statement{}, tc.input) if !reflect.DeepEqual(actual, tc.expect) { t.Errorf("expect %v got %v", tc.expect, actual) } }) } } func TestConvertSliceOfMapToValuesForCreate(t *testing.T) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 05 02:22:57 UTC 2024 - 3.4K bytes - Viewed (0) -
callbacks/create.go
curTime := stmt.DB.NowFunc() switch value := stmt.Dest.(type) { case map[string]interface{}: values = ConvertMapToValuesForCreate(stmt, value) case *map[string]interface{}: values = ConvertMapToValuesForCreate(stmt, *value) case []map[string]interface{}: values = ConvertSliceOfMapToValuesForCreate(stmt, value) case *[]map[string]interface{}:
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Apr 08 03:29:55 UTC 2024 - 12.5K bytes - Viewed (0)