Fix code
This commit is contained in:
parent
056952e17a
commit
2255193c57
|
@ -618,8 +618,8 @@ func (db *dameng) SQLType(c *schemas.Column) string {
|
|||
res = t
|
||||
}
|
||||
|
||||
hasLen1 := (c.Length > 0)
|
||||
hasLen2 := (c.Length2 > 0)
|
||||
hasLen1 := c.Length > 0
|
||||
hasLen2 := c.Length2 > 0
|
||||
|
||||
if hasLen2 {
|
||||
res += "(" + strconv.FormatInt(c.Length, 10) + "," + strconv.FormatInt(c.Length2, 10) + ")"
|
||||
|
|
|
@ -334,7 +334,7 @@ func (db *mssql) SQLType(c *schemas.Column) string {
|
|||
case schemas.TimeStampz:
|
||||
res = "DATETIMEOFFSET"
|
||||
c.Length = 7
|
||||
case schemas.MediumInt, schemas.TinyInt, schemas.SmallInt, schemas.UnsignedMediumInt, schemas.UnsignedTinyInt, schemas.UnsignedSmallInt:
|
||||
case schemas.MediumInt, schemas.SmallInt, schemas.UnsignedMediumInt, schemas.UnsignedTinyInt, schemas.UnsignedSmallInt:
|
||||
res = schemas.Int
|
||||
case schemas.Text, schemas.MediumText, schemas.TinyText, schemas.LongText, schemas.Json:
|
||||
res = db.defaultVarchar + "(MAX)"
|
||||
|
@ -377,8 +377,8 @@ func (db *mssql) SQLType(c *schemas.Column) string {
|
|||
return res
|
||||
}
|
||||
|
||||
hasLen1 := (c.Length > 0)
|
||||
hasLen2 := (c.Length2 > 0)
|
||||
hasLen1 := c.Length > 0
|
||||
hasLen2 := c.Length2 > 0
|
||||
|
||||
if hasLen2 {
|
||||
res += "(" + strconv.FormatInt(c.Length, 10) + "," + strconv.FormatInt(c.Length2, 10) + ")"
|
||||
|
|
|
@ -326,8 +326,8 @@ func (db *mysql) SQLType(c *schemas.Column) string {
|
|||
res = t
|
||||
}
|
||||
|
||||
hasLen1 := (c.Length > 0)
|
||||
hasLen2 := (c.Length2 > 0)
|
||||
hasLen1 := c.Length > 0
|
||||
hasLen2 := c.Length2 > 0
|
||||
|
||||
if res == schemas.BigInt && !hasLen1 && !hasLen2 {
|
||||
c.Length = 20
|
||||
|
|
|
@ -585,8 +585,8 @@ func (db *oracle) SQLType(c *schemas.Column) string {
|
|||
res = t
|
||||
}
|
||||
|
||||
hasLen1 := (c.Length > 0)
|
||||
hasLen2 := (c.Length2 > 0)
|
||||
hasLen1 := c.Length > 0
|
||||
hasLen2 := c.Length2 > 0
|
||||
|
||||
if hasLen2 {
|
||||
res += "(" + strconv.FormatInt(c.Length, 10) + "," + strconv.FormatInt(c.Length2, 10) + ")"
|
||||
|
|
|
@ -957,8 +957,8 @@ func (db *postgres) SQLType(c *schemas.Column) string {
|
|||
// for bool, we don't need length information
|
||||
return res
|
||||
}
|
||||
hasLen1 := (c.Length > 0)
|
||||
hasLen2 := (c.Length2 > 0)
|
||||
hasLen1 := c.Length > 0
|
||||
hasLen2 := c.Length2 > 0
|
||||
|
||||
if hasLen2 {
|
||||
res += "(" + strconv.FormatInt(c.Length, 10) + "," + strconv.FormatInt(c.Length2, 10) + ")"
|
||||
|
@ -1185,7 +1185,7 @@ WHERE n.nspname= s.table_schema AND c.relkind = 'r' AND c.relname = $1%s AND f.a
|
|||
col.IsPrimaryKey = true
|
||||
}
|
||||
|
||||
col.Nullable = (isNullable == "YES")
|
||||
col.Nullable = isNullable == "YES"
|
||||
|
||||
switch strings.ToLower(dataType) {
|
||||
case "character varying", "string":
|
||||
|
|
|
@ -1206,7 +1206,7 @@ func (engine *Engine) Insert(beans ...interface{}) (int64, error) {
|
|||
func (engine *Engine) InsertOne(bean interface{}) (int64, error) {
|
||||
session := engine.NewSession()
|
||||
defer session.Close()
|
||||
return session.InsertOne(bean)
|
||||
return session.Insert(bean)
|
||||
}
|
||||
|
||||
// Update records, bean's non-empty fields are updated contents,
|
||||
|
|
|
@ -50,7 +50,7 @@ var ErrNoColumnName = errors.New("no column name")
|
|||
|
||||
func (statement *Statement) writeOrderBy(w *builder.BytesWriter, orderBy orderBy) error {
|
||||
switch t := orderBy.orderStr.(type) {
|
||||
case (*builder.Expression):
|
||||
case *builder.Expression:
|
||||
if _, err := fmt.Fprint(w.Builder, statement.dialect.Quoter().Replace(t.Content())); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ func isASCIIUpper(r rune) bool {
|
|||
|
||||
func toASCIIUpper(r rune) rune {
|
||||
if 'a' <= r && r <= 'z' {
|
||||
r -= ('a' - 'A')
|
||||
r -= 'a' - 'A'
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ func PKTagHandler(ctx *Context) error {
|
|||
|
||||
// NULLTagHandler describes null tag handler
|
||||
func NULLTagHandler(ctx *Context) error {
|
||||
ctx.col.Nullable = (strings.ToUpper(ctx.preTag) != "NOT")
|
||||
ctx.col.Nullable = strings.ToUpper(ctx.preTag) != "NOT"
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue