feat: Change CreateSchemaFromJson to CreateSchema
This commit is contained in:
17
build/create.go
Normal file
17
build/create.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"git.secnex.io/secnex/pgson/schema"
|
||||
)
|
||||
|
||||
func Create(s *schema.Table) (string, error) {
|
||||
schemaParts := make([]string, len(s.Schema))
|
||||
for i, field := range s.Schema {
|
||||
schemaParts[i] = field.SQL()
|
||||
}
|
||||
query := fmt.Sprintf("CREATE TABLE %s (%s)", s.Name, strings.Join(schemaParts, ",\n"))
|
||||
return query, nil
|
||||
}
|
||||
Reference in New Issue
Block a user