本文整理匯總了Golang中github.com/markbates/pop/fizz.AString函數的典型用法代碼示例。如果您正苦於以下問題:Golang AString函數的具體用法?Golang AString怎麽用?Golang AString使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AString函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}