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

Method getPrimaryField

pkg/sql2code/parser/postgresql.go:107–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

105type PGFields []*PGField
106
107func (fields PGFields) getPrimaryField() *PGField {
108 var f *PGField
109 for _, field := range fields {
110 if field.IsPrimaryKey || field.Name == "id" {
111 f = field
112 return f
113 }
114 }
115 return f
116}
117
118func getPostgresqlTableFields(db *gorm.DB, tableName string) (PGFields, error) {
119 query := fmt.Sprintf(`SELECT

Callers 1

ConvertToSQLByPgFieldsFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected