format code (#884)

master
Kevin Wan 3 years ago committed by GitHub
parent a74aaf1823
commit 02adcccbf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -122,7 +122,7 @@ func RawFieldNames(in interface{}, postgresSql ...bool) []string {
}
func PostgreSqlJoin(elems []string) string {
var b = new(strings.Builder)
b := new(strings.Builder)
for index, e := range elems {
b.WriteString(fmt.Sprintf("%s = $%d, ", e, index+1))
}

@ -50,7 +50,7 @@ func genCacheKeys(table parser.Table) (Key, []Key) {
return primaryKey, uniqueKey
}
func genCacheKey(db stringx.String, table stringx.String, in []*parser.Field) Key {
func genCacheKey(db, table stringx.String, in []*parser.Field) Key {
var (
varLeftJoin, varRightJon, fieldNameJoin Join
varLeft, varRight, varExpression string

@ -7,8 +7,7 @@ import (
"github.com/tal-tech/go-zero/core/stores/sqlx"
)
var (
p2m = map[string]string{
var p2m = map[string]string{
"int8": "bigint",
"numeric": "bigint",
"float8": "double",
@ -16,7 +15,6 @@ var (
"int2": "smallint",
"int4": "integer",
}
)
// PostgreSqlModel gets table information from information_schema、pg_catalog
type PostgreSqlModel struct {
@ -173,7 +171,7 @@ func (m *PostgreSqlModel) getIndex(schema, table string) (map[string][]*DbIndex,
if err != nil {
return nil, err
}
var index = make(map[string][]*DbIndex)
index := make(map[string][]*DbIndex)
for _, e := range indexes {
if e.IsPrimary.Bool {
index[e.ColumnName.String] = append(index[e.ColumnName.String], &DbIndex{

@ -47,7 +47,7 @@ type (
)
// Parse parses ddl into golang structure
func Parse(filename string, database string) ([]*Table, error) {
func Parse(filename, database string) ([]*Table, error) {
p := parser.NewParser()
tables, err := p.From(filename)
if err != nil {

Loading…
Cancel
Save