MCPcopy
hub / github.com/zeromicro/go-zero / PostgreSqlDataSource

Function PostgreSqlDataSource

tools/goctl/model/sql/command/command.go:196–242  ·  view source on GitHub ↗

PostgreSqlDataSource generates model code from datasource

(_ *cobra.Command, _ []string)

Source from the content-addressed store, hash-verified

194
195// PostgreSqlDataSource generates model code from datasource
196func PostgreSqlDataSource(_ *cobra.Command, _ []string) error {
197 migrationnotes.BeforeCommands(VarStringDir, VarStringStyle)
198 url := strings.TrimSpace(VarStringURL)
199 dir := strings.TrimSpace(VarStringDir)
200 cache := VarBoolCache
201 idea := VarBoolIdea
202 style := VarStringStyle
203 schema := VarStringSchema
204 home := VarStringHome
205 remote := VarStringRemote
206 branch := VarStringBranch
207 if len(remote) > 0 {
208 repo, _ := file.CloneIntoGitHome(remote, branch)
209 if len(repo) > 0 {
210 home = repo
211 }
212 }
213 if len(home) > 0 {
214 pathx.RegisterGoctlHome(home)
215 }
216
217 if len(schema) == 0 {
218 schema = "public"
219 }
220
221 patterns := parseTableList(VarStringSliceTable)
222 cfg, err := config.NewConfig(style)
223 if err != nil {
224 return err
225 }
226 ignoreColumns := mergeColumns(VarStringSliceIgnoreColumns)
227
228 arg := pgDataSourceArg{
229 url: url,
230 dir: dir,
231 tablePat: patterns,
232 schema: schema,
233 cfg: cfg,
234 cache: cache,
235 idea: idea,
236 strict: VarBoolStrict,
237 ignoreColumns: ignoreColumns,
238 prefix: VarStringCachePrefix,
239 }
240
241 return fromPostgreSqlDataSource(arg)
242}
243
244type ddlArg struct {
245 src, dir string

Callers

nothing calls this directly

Calls 6

BeforeCommandsFunction · 0.92
RegisterGoctlHomeFunction · 0.92
NewConfigFunction · 0.92
parseTableListFunction · 0.85
mergeColumnsFunction · 0.85
fromPostgreSqlDataSourceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…