1
0
mirror of https://github.com/astaxie/beego.git synced 2025-06-11 20:10:40 +00:00

Format code

This commit is contained in:
Ming Deng
2020-07-22 23:00:06 +08:00
parent 9c51952db4
commit 30eb889a91
37 changed files with 133 additions and 133 deletions

View File

@ -197,9 +197,9 @@ func getDbCreateSQL(al *alias) (sqls []string, tableIndexes map[string][]dbIndex
if strings.Contains(column, "%COL%") {
column = strings.Replace(column, "%COL%", fi.column, -1)
}
if fi.description != "" && al.Driver!=DRSqlite {
column += " " + fmt.Sprintf("COMMENT '%s'",fi.description)
if fi.description != "" && al.Driver != DRSqlite {
column += " " + fmt.Sprintf("COMMENT '%s'", fi.description)
}
columns = append(columns, column)

View File

@ -244,7 +244,7 @@ var _ dbQuerier = new(TxDB)
var _ txEnder = new(TxDB)
func (t *TxDB) Prepare(query string) (*sql.Stmt, error) {
return t.PrepareContext(context.Background(),query)
return t.PrepareContext(context.Background(), query)
}
func (t *TxDB) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) {
@ -260,7 +260,7 @@ func (t *TxDB) ExecContext(ctx context.Context, query string, args ...interface{
}
func (t *TxDB) Query(query string, args ...interface{}) (*sql.Rows, error) {
return t.QueryContext(context.Background(),query,args...)
return t.QueryContext(context.Background(), query, args...)
}
func (t *TxDB) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) {
@ -268,7 +268,7 @@ func (t *TxDB) QueryContext(ctx context.Context, query string, args ...interface
}
func (t *TxDB) QueryRow(query string, args ...interface{}) *sql.Row {
return t.QueryRowContext(context.Background(),query,args...)
return t.QueryRowContext(context.Background(), query, args...)
}
func (t *TxDB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row {

View File

@ -490,11 +490,11 @@ func init() {
}
err := RegisterDataBase("default", DBARGS.Driver, DBARGS.Source, common.KV{
Key:MaxIdleConnsKey,
Value:20,
Key: MaxIdleConnsKey,
Value: 20,
})
if err != nil{
if err != nil {
panic(fmt.Sprintf("can not register database: %v", err))
}

View File

@ -61,7 +61,7 @@ func debugLogQueies(alias *alias, operaton, query string, t time.Time, err error
con += " - " + err.Error()
}
logMap["sql"] = fmt.Sprintf("%s-`%s`", query, strings.Join(cons, "`, `"))
if LogFunc != nil{
if LogFunc != nil {
LogFunc(logMap)
}
DebugLog.Println(con)

View File

@ -110,7 +110,7 @@ type DQL interface {
// Like Read(), but with "FOR UPDATE" clause, useful in transaction.
// Some databases are not support this feature.
ReadForUpdate( md interface{}, cols ...string) error
ReadForUpdate(md interface{}, cols ...string) error
ReadForUpdateWithCtx(ctx context.Context, md interface{}, cols ...string) error
// Try to read a row from the database, or insert one if it doesn't exist
@ -129,14 +129,14 @@ type DQL interface {
// args[2] int offset default offset 0
// args[3] string order for example : "-Id"
// make sure the relation is defined in model struct tags.
LoadRelated( md interface{}, name string, args ...interface{}) (int64, error)
LoadRelated(md interface{}, name string, args ...interface{}) (int64, error)
LoadRelatedWithCtx(ctx context.Context, md interface{}, name string, args ...interface{}) (int64, error)
// create a models to models queryer
// for example:
// post := Post{Id: 4}
// m2m := Ormer.QueryM2M(&post, "Tags")
QueryM2M( md interface{}, name string) QueryM2Mer
QueryM2M(md interface{}, name string) QueryM2Mer
QueryM2MWithCtx(ctx context.Context, md interface{}, name string) QueryM2Mer
// return a QuerySeter for table operations.