Fixed drone build

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
This commit is contained in:
Alexey Terentyev 2018-06-24 17:34:23 +03:00
parent 7f854f3ee7
commit d1f1b7a5c2
No known key found for this signature in database
GPG Key ID: 60D6C550AEEBB467
5 changed files with 123 additions and 5 deletions

5
Gopkg.lock generated
View File

@ -299,8 +299,7 @@
[[projects]]
name = "github.com/go-xorm/builder"
packages = ["."]
revision = "bad0a612f0d6277b953910822ab5dfb30dd18237"
version = "v0.2.0"
revision = "9283e7910554af2071cdb04c71b18e5a6ee1ca40"
[[projects]]
name = "github.com/go-xorm/core"
@ -875,6 +874,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "4aeb6b1c6c7d9e4c915c19802c66d6503044797f7881dc42424cdd250ce9513e"
inputs-digest = "c3d7e9c0a37b01871b651b18a44c8a77a9a91f2e43e360178282ea9e3d667248"
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -46,7 +46,8 @@ ignored = ["google.golang.org/appengine*"]
[[override]]
name = "github.com/go-xorm/builder"
version = "0.2.0"
#version = "0.2.0"
revision = "9283e7910554af2071cdb04c71b18e5a6ee1ca40"
[[override]]
name = "github.com/gorilla/mux"

View File

@ -191,7 +191,7 @@ var migrations = []Migration{
// v68 -> V69
NewMigration("Reformat and remove incorrect topics", reformatAndRemoveIncorrectTopics),
// v69 -> v70
//NewMigration("move team units to team_unit table", moveTeamUnitsToTeamUnitTable),
NewMigration("move team units to team_unit table", moveTeamUnitsToTeamUnitTable),
}
// Migrate database to current version

View File

@ -67,6 +67,11 @@ func (b *Builder) From(tableName string) *Builder {
return b
}
// TableName returns the table name
func (b *Builder) TableName() string {
return b.tableName
}
// Into sets insert table name
func (b *Builder) Into(tableName string) *Builder {
b.tableName = tableName

113
vendor/github.com/go-xorm/xorm/engine_table.go generated vendored Normal file
View File

@ -0,0 +1,113 @@
// Copyright 2018 The Xorm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package xorm
import (
"fmt"
"reflect"
"strings"
"github.com/go-xorm/core"
)
// TableNameWithSchema will automatically add schema prefix on table name
func (engine *Engine) tbNameWithSchema(v string) string {
// Add schema name as prefix of table name.
// Only for postgres database.
if engine.dialect.DBType() == core.POSTGRES &&
engine.dialect.URI().Schema != "" &&
engine.dialect.URI().Schema != postgresPublicSchema &&
strings.Index(v, ".") == -1 {
return engine.dialect.URI().Schema + "." + v
}
return v
}
// TableName returns table name with schema prefix if has
func (engine *Engine) TableName(bean interface{}, includeSchema ...bool) string {
tbName := engine.tbNameNoSchema(bean)
if len(includeSchema) > 0 && includeSchema[0] {
tbName = engine.tbNameWithSchema(tbName)
}
return tbName
}
// tbName get some table's table name
func (session *Session) tbNameNoSchema(table *core.Table) string {
if len(session.statement.AltTableName) > 0 {
return session.statement.AltTableName
}
return table.Name
}
func (engine *Engine) tbNameForMap(v reflect.Value) string {
if v.Type().Implements(tpTableName) {
return v.Interface().(TableName).TableName()
}
if v.Kind() == reflect.Ptr {
v = v.Elem()
if v.Type().Implements(tpTableName) {
return v.Interface().(TableName).TableName()
}
}
return engine.TableMapper.Obj2Table(v.Type().Name())
}
func (engine *Engine) tbNameNoSchema(tablename interface{}) string {
switch tablename.(type) {
case []string:
t := tablename.([]string)
if len(t) > 1 {
return fmt.Sprintf("%v AS %v", engine.Quote(t[0]), engine.Quote(t[1]))
} else if len(t) == 1 {
return engine.Quote(t[0])
}
case []interface{}:
t := tablename.([]interface{})
l := len(t)
var table string
if l > 0 {
f := t[0]
switch f.(type) {
case string:
table = f.(string)
case TableName:
table = f.(TableName).TableName()
default:
v := rValue(f)
t := v.Type()
if t.Kind() == reflect.Struct {
table = engine.tbNameForMap(v)
} else {
table = engine.Quote(fmt.Sprintf("%v", f))
}
}
}
if l > 1 {
return fmt.Sprintf("%v AS %v", engine.Quote(table),
engine.Quote(fmt.Sprintf("%v", t[1])))
} else if l == 1 {
return engine.Quote(table)
}
case TableName:
return tablename.(TableName).TableName()
case string:
return tablename.(string)
case reflect.Value:
v := tablename.(reflect.Value)
return engine.tbNameForMap(v)
default:
v := rValue(tablename)
t := v.Type()
if t.Kind() == reflect.Struct {
return engine.tbNameForMap(v)
}
return engine.Quote(fmt.Sprintf("%v", tablename))
}
return ""
}