本文整理汇总了Golang中github.com/markbates/pop/fizz.AString函数的典型用法代码示例。如果您正苦于以下问题:Golang AString函数的具体用法?Golang AString怎么用?Golang AString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Test_SQLite_RenameIndex
func (p *SQLiteSuite) Test_SQLite_RenameIndex() {
r := p.Require()
ddl := `DROP INDEX IF EXISTS "old_ix";
CREATE UNIQUE INDEX "new_ix" ON "users" (id, created_at);`
schema.schema["users"] = &fizz.Table{
Name: "users",
Columns: []fizz.Column{
fizz.ID_COL,
fizz.CREATED_COL,
fizz.UPDATED_COL,
},
Indexes: []fizz.Index{
{
Name: "old_ix",
Columns: []string{"id", "created_at"},
Unique: true,
},
},
}
res, _ := fizz.AString(`rename_index("users", "old_ix", "new_ix")`, sqt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:25,代码来源:sqlite_test.go
示例2: Test_MySQL_AddIndex_CustomName
func (p *MySQLSuite) Test_MySQL_AddIndex_CustomName() {
r := p.Require()
ddl := `CREATE INDEX email_index ON users (email);`
res, _ := fizz.AString(`add_index("users", "email", {"name": "email_index"})`, myt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:7,代码来源:mysql_test.go
示例3: Test_MySQL_DropIndex
func (p *MySQLSuite) Test_MySQL_DropIndex() {
r := p.Require()
ddl := `DROP INDEX email_idx ON users;`
res, _ := fizz.AString(`drop_index("users", "email_idx")`, myt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:7,代码来源:mysql_test.go
示例4: Test_MySQL_AddIndex_Unique
func (p *MySQLSuite) Test_MySQL_AddIndex_Unique() {
r := p.Require()
ddl := `CREATE UNIQUE INDEX users_email_idx ON users (email);`
res, _ := fizz.AString(`add_index("users", "email", {"unique": true})`, myt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:7,代码来源:mysql_test.go
示例5: Test_MySQL_CreateTable
func (p *MySQLSuite) Test_MySQL_CreateTable() {
r := p.Require()
ddl := `CREATE TABLE users (
id integer NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
first_name VARCHAR (255) NOT NULL,
last_name VARCHAR (255) NOT NULL,
email VARCHAR (20) NOT NULL,
permissions text,
age integer DEFAULT 40
) ENGINE=InnoDB;`
res, _ := fizz.AString(`
create_table("users", func(t) {
t.Column("first_name", "string", {})
t.Column("last_name", "string", {})
t.Column("email", "string", {"size":20})
t.Column("permissions", "text", {"null": true})
t.Column("age", "integer", {"null": true, "default": 40})
})
`, myt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:25,代码来源:mysql_test.go
示例6: Test_Postgres_DropIndex
func (p *PostgreSQLSuite) Test_Postgres_DropIndex() {
r := p.Require()
ddl := `DROP INDEX "my_idx";`
res, _ := fizz.AString(`drop_index("users", "my_idx")`, pgt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:7,代码来源:postgres_test.go
示例7: Test_SQLite_DropIndex
func (p *SQLiteSuite) Test_SQLite_DropIndex() {
r := p.Require()
ddl := `DROP INDEX IF EXISTS "my_idx";`
res, _ := fizz.AString(`drop_index("my_table", "my_idx")`, sqt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:7,代码来源:sqlite_test.go
示例8: Test_MySQL_AddIndex_MultiColumn
func (p *MySQLSuite) Test_MySQL_AddIndex_MultiColumn() {
r := p.Require()
ddl := `CREATE INDEX users_id_email_idx ON users (id, email);`
res, _ := fizz.AString(`add_index("users", ["id", "email"], {})`, myt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:7,代码来源:mysql_test.go
示例9: Test_SQLite_AddIndex_MultiColumn
func (p *SQLiteSuite) Test_SQLite_AddIndex_MultiColumn() {
r := p.Require()
ddl := `CREATE INDEX "table_name_col1_col2_col3_idx" ON "table_name" (col1, col2, col3);`
res, _ := fizz.AString(`add_index("table_name", ["col1", "col2", "col3"], {})`, sqt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:7,代码来源:sqlite_test.go
示例10: Test_SQLite_AddIndex_CustomName
func (p *SQLiteSuite) Test_SQLite_AddIndex_CustomName() {
r := p.Require()
ddl := `CREATE INDEX "custom_name" ON "table_name" (column_name);`
res, _ := fizz.AString(`add_index("table_name", "column_name", {"name": "custom_name"})`, sqt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:7,代码来源:sqlite_test.go
示例11: Test_SQLite_AddIndex_Unique
func (p *SQLiteSuite) Test_SQLite_AddIndex_Unique() {
r := p.Require()
ddl := `CREATE UNIQUE INDEX "table_name_column_name_idx" ON "table_name" (column_name);`
res, _ := fizz.AString(`add_index("table_name", "column_name", {"unique": true})`, sqt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:7,代码来源:sqlite_test.go
示例12: Test_Postgres_AddIndex
func (p *PostgreSQLSuite) Test_Postgres_AddIndex() {
r := p.Require()
ddl := `CREATE INDEX "table_name_column_name_idx" ON "table_name" (column_name);`
res, _ := fizz.AString(`add_index("table_name", "column_name", {})`, pgt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:7,代码来源:postgres_test.go
示例13: Test_Postgres_RenameColumn
func (p *PostgreSQLSuite) Test_Postgres_RenameColumn() {
r := p.Require()
ddl := `ALTER TABLE "table_name" RENAME COLUMN "old_column" TO "new_column";`
res, _ := fizz.AString(`rename_column("table_name", "old_column", "new_column")`, pgt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:7,代码来源:postgres_test.go
示例14: Test_MySQL_RenameColumn
func (p *MySQLSuite) Test_MySQL_RenameColumn() {
r := p.Require()
ddl := `ALTER TABLE users CHANGE email email_address varchar(50) NOT NULL DEFAULT '[email protected]';`
res, _ := fizz.AString(`rename_column("users", "email", "email_address")`, myt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:7,代码来源:mysql_test.go
示例15: Test_MySQL_DropColumn
func (p *MySQLSuite) Test_MySQL_DropColumn() {
r := p.Require()
ddl := `ALTER TABLE users DROP COLUMN mycolumn;`
res, _ := fizz.AString(`drop_column("users", "mycolumn")`, myt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:8,代码来源:mysql_test.go
示例16: Test_MySQL_RenameIndex
func (p *MySQLSuite) Test_MySQL_RenameIndex() {
r := p.Require()
ddl := `ALTER TABLE users RENAME INDEX email_idx TO email_address_ix;`
res, _ := fizz.AString(`rename_index("users", "email_idx", "email_address_ix")`, myt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:8,代码来源:mysql_test.go
示例17: Test_MySQL_DropTable
func (p *MySQLSuite) Test_MySQL_DropTable() {
r := p.Require()
ddl := `DROP TABLE "users";`
res, _ := fizz.AString(`drop_table("users")`, myt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:8,代码来源:mysql_test.go
示例18: Test_SQLite_DropTable
func (p *SQLiteSuite) Test_SQLite_DropTable() {
r := p.Require()
ddl := `DROP TABLE "users";`
res, _ := fizz.AString(`drop_table("users")`, sqt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:8,代码来源:sqlite_test.go
示例19: Test_Postgres_DropColumn
func (p *PostgreSQLSuite) Test_Postgres_DropColumn() {
r := p.Require()
ddl := `ALTER TABLE "table_name" DROP COLUMN "column_name";`
res, _ := fizz.AString(`drop_column("table_name", "column_name")`, pgt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:8,代码来源:postgres_test.go
示例20: Test_Postgres_DropTable
func (p *PostgreSQLSuite) Test_Postgres_DropTable() {
r := p.Require()
ddl := `DROP TABLE "users";`
res, _ := fizz.AString(`drop_table("users")`, pgt)
r.Equal(ddl, res)
}
开发者ID:markbates,项目名称:pop,代码行数:8,代码来源:postgres_test.go
注:本文中的github.com/markbates/pop/fizz.AString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论