Documentation ¶
Index ¶
- func CreateDB(driverName, connectionUrl string) error
- func CreateDBWithConUrl(driverName, connectionUrl, dbName string) error
- func DropDB(driverName, connectionUrl string) error
- func DropDBWithConUrl(driverName, connectionUrl, dbName string) error
- type DDL
- func (s *DDL) AddFKs(table interface{})
- func (s *DDL) AddTables(tables ...interface{})
- func (s *DDL) ForeignKeyCheck(enable bool) error
- func (s *DDL) GetSchema(obj interface{}) *schema.Schema
- func (s *DDL) GetSchemaByStructName(structName string) *schema.Schema
- func (s *DDL) GetTableName(tableStruct interface{}) string
- func (s *DDL) GetTablePK(tableStruct interface{}) string
- func (s *DDL) MakeFKs()
- func (s *DDL) MatchTableName(structType reflect.Type, tableName string) bool
- func (s *DDL) ParseFKInfo(tag string) FKInfo
- func (s *DDL) Range(f func(structType reflect.Type, tableSchema *schema.Schema) bool)
- type FKAction
- type FKInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDBWithConUrl ¶
func DropDBWithConUrl ¶
Types ¶
type DDL ¶
type DDL struct { DefaultOnDelete FKAction DefaultOnUpdate FKAction // contains filtered or unexported fields }
func (*DDL) ForeignKeyCheck ¶
func (*DDL) GetSchemaByStructName ¶
func (*DDL) GetTableName ¶
func (*DDL) GetTablePK ¶
func (*DDL) MatchTableName ¶
func (*DDL) ParseFKInfo ¶
tag: eg1. fk:User.Id,ondelete=CASCADE,onupdate=CASCADE -> ALTER TABLE User ADD CONSTRAINT fkname FOREIGN KEY (id) REFERENCES on delete CASCADE,on update CASCADE eg2. fk:User,ondelete=SET NULL,onupdate=CASCADE -> ALTER TABLE User ADD CONSTRAINT fkname FOREIGN KEY (id) REFERENCES on delete CASCADE,on update CASCADE
Click to show internal directories.
Click to hide internal directories.