MCPcopy Index your code
hub / github.com/go-dev-frame/sponge / getUpdateFieldsCode

Function getUpdateFieldsCode

pkg/sql2code/parser/parser.go:866–894  ·  view source on GitHub ↗
(data tmplData, isEmbed bool)

Source from the content-addressed store, hash-verified

864}
865
866func getUpdateFieldsCode(data tmplData, isEmbed bool) (string, error) {
867 _ = isEmbed
868
869 // filter fields
870 var newFields = []tmplField{}
871 for _, field := range data.Fields {
872 falseColumns := []string{}
873 if isIgnoreFields(field.ColName, falseColumns...) || field.ColName == columnID || field.ColName == _columnID {
874 continue
875 }
876 switch field.DBDriver {
877 case DBDriverMysql, DBDriverTidb, DBDriverPostgresql:
878 if field.rewriterField != nil {
879 if field.rewriterField.goType == jsonTypeName {
880 field.GoType = "[]byte"
881 }
882 }
883 }
884 newFields = append(newFields, field)
885 }
886 data.Fields = newFields
887
888 buf := new(bytes.Buffer)
889 err := updateFieldTmpl.Execute(buf, data)
890 if err != nil {
891 return "", err
892 }
893 return buf.String(), nil
894}
895
896func getHandlerStructCodes(data tmplData, jsonNamedType int) (string, error) {
897 newFields := []tmplField{}

Callers 1

makeCodeFunction · 0.85

Calls 3

isIgnoreFieldsFunction · 0.85
ExecuteMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…