本文整理匯總了Golang中github.com/coocood/assrt.Assert.Logf方法的典型用法代碼示例。如果您正苦於以下問題:Golang Assert.Logf方法的具體用法?Golang Assert.Logf怎麽用?Golang Assert.Logf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/coocood/assrt.Assert
的用法示例。
在下文中一共展示了Assert.Logf方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: DoTestCreateIndexSql
func DoTestCreateIndexSql(assert *assrt.Assert, info dialectSyntax) {
assert.Logf("Dialect %T\n", info.dialect)
sql := info.dialect.CreateIndexSql("iname", "itable", true, "a", "b", "c")
assert.Equal(info.createUniqueIndexSql, sql)
sql = info.dialect.CreateIndexSql("iname2", "itable2", false, "d", "e")
assert.Equal(info.createIndexSql, sql)
}
示例2: DoTestDeleteSQL
func DoTestDeleteSQL(assert *assrt.Assert, info dialectSyntax) {
assert.Logf("Dialect %T\n", info.dialect)
model := structPtrToModel(sqlGenSampleData, true, nil)
criteria := &Criteria{model: model}
criteria.mergePkCondition(info.dialect)
sql, _ := info.dialect.DeleteSql(criteria)
sql = info.dialect.SubstituteMarkers(sql)
assert.Equal(info.deleteSql, sql)
}
示例3: DoTestSelectionSQL
func DoTestSelectionSQL(assert *assrt.Assert, info dialectSyntax) {
assert.Logf("Dialect %T\n", info.dialect)
type User struct {
Id int64
Name string
}
type Post struct {
Id int64
AuthorId int64 `qbs:"fk:Author"`
Author *User
Content string
}
model := structPtrToModel(new(Post), true, nil)
criteria := new(Criteria)
criteria.model = model
sql, _ := info.dialect.QuerySql(criteria)
assert.Equal(info.selectionSql, sql)
}
示例4: DoTestCreateTable
func DoTestCreateTable(assert *assrt.Assert, info dialectInfo) {
assert.Logf("Dialect %T\n", info.dialect)
mg, _ := setupDb(assert, info)
{
type AddColumn struct {
Prim Id
}
table := &AddColumn{}
mg.dropTableIfExists(table)
mg.CreateTableIfNotExists(table)
columns := mg.Dialect.ColumnsInTable(mg, table)
assert.OneLen(columns)
assert.True(columns["prim"])
}
table := &AddColumn{}
mg.CreateTableIfNotExists(table)
columns := mg.Dialect.ColumnsInTable(mg, table)
assert.Equal(4, len(columns))
}
示例5: DoTestQuerySQL
func DoTestQuerySQL(assert *assrt.Assert, info dialectSyntax) {
assert.Logf("Dialect %T\n", info.dialect)
type Student struct {
Name string
Grade int
Score int
}
model := structPtrToModel(new(Student), true, nil)
criteria := new(Criteria)
criteria.model = model
condition := NewInCondition("grade", []interface{}{6, 7, 8})
subCondition := NewCondition("score <= ?", 60).Or("score >= ?", 80)
condition.AndCondition(subCondition)
criteria.condition = condition
criteria.orderBys = []order{order{info.dialect.Quote("name"), false}, order{info.dialect.Quote("grade"), true}}
criteria.offset = 3
criteria.limit = 10
sql, _ := info.dialect.QuerySql(criteria)
sql = info.dialect.SubstituteMarkers(sql)
assert.Equal(info.querySql, sql)
}
示例6: DoTestCreateTable
func DoTestCreateTable(assert *assrt.Assert, info dialectInfo) {
assert.Logf("Dialect %T\n", info.dialect)
mg, _ := setupDb(assert, info)
defer mg.Close()
{
type AddColumn struct {
Prim int64 `qbs:"pk"`
}
table := &AddColumn{}
mg.dropTableIfExists(table)
mg.CreateTableIfNotExists(table)
columns := mg.Dialect.ColumnsInTable(mg, table)
assert.OneLen(columns)
assert.True(columns["prim"])
}
table := &AddColumn{}
mg.CreateTableIfNotExists(table)
assert.True(mg.Dialect.IndexExists(mg, "add_column", "add_column_first_last"))
columns := mg.Dialect.ColumnsInTable(mg, table)
assert.Equal(4, len(columns))
}
示例7: DoTestCreateTableSql
func DoTestCreateTableSql(assert *assrt.Assert, info dialectSyntax) {
assert.Logf("Dialect %T\n", info.dialect)
type withoutPk struct {
First string
Last string
Amount int
}
table := &withoutPk{"a", "b", 5}
model := structPtrToModel(table, true, nil)
sql := info.dialect.CreateTableSql(model, true)
assert.Equal(info.createTableWithoutPkIfExistsSql, sql)
type withPk struct {
Primary int64 `qbs:"pk"`
First string
Last string
Amount int
}
table2 := &withPk{First: "a", Last: "b", Amount: 5}
model = structPtrToModel(table2, true, nil)
sql = info.dialect.CreateTableSql(model, false)
assert.Equal(info.createTableWithPkSql, sql)
}
示例8: DoTestAddColumSQL
func DoTestAddColumSQL(assert *assrt.Assert, info dialectSyntax) {
assert.Logf("Dialect %T\n", info.dialect)
sql := info.dialect.AddColumnSql("a", "c", "", 100)
assert.Equal(info.addColumnSql, sql)
}
示例9: DoTestDropTableSQL
func DoTestDropTableSQL(assert *assrt.Assert, info dialectSyntax) {
assert.Logf("Dialect %T\n", info.dialect)
sql := info.dialect.DropTableSql("drop_table")
assert.Equal(info.dropTableIfExistsSql, sql)
}