Documentation ¶
Index ¶
- Constants
- Variables
- func ColumnDefaultValue(typeName string) string
- type ColumnExtra
- type ColumnInfo
- func (ci *ColumnInfo) GetDbType() string
- func (ci *ColumnInfo) GetDefault() string
- func (ci *ColumnInfo) GetDefine() string
- func (ci *ColumnInfo) GetPrecision() (int, int)
- func (ci *ColumnInfo) GetSize() int
- func (ci *ColumnInfo) IsIndex() bool
- func (ci *ColumnInfo) IsNotNull() bool
- func (ci *ColumnInfo) IsPrimaryKey() bool
- type ConnParams
- type Dialect
- type FetchFunc
- type IndexKeyType
- type Mssql
- func (d Mssql) ColumnInfoSql(table, dbname string) string
- func (Mssql) ColumnTypeSql(fullTableName string) string
- func (d Mssql) CurrDbNameSql() string
- func (Mssql) GetDSN(params ConnParams) (string, string)
- func (Mssql) QuoteIdent(ident string) string
- func (d Mssql) TableNameSql(dbname string, more bool) string
- func (d Mssql) ViewNameSql(dbname string, more bool) string
- type Mysql
- func (d Mysql) ColumnInfoSql(table, dbname string) string
- func (Mysql) ColumnTypeSql(fullTableName string) string
- func (d Mysql) CurrDbNameSql() string
- func (Mysql) GetDSN(params ConnParams) (string, string)
- func (Mysql) QuoteIdent(ident string) string
- func (d Mysql) TableNameSql(dbname string, more bool) string
- func (d Mysql) ViewNameSql(dbname string, more bool) string
- type Oracle
- func (d Oracle) ColumnInfoSql(table, dbname string) string
- func (Oracle) ColumnTypeSql(fullTableName string) string
- func (Oracle) CurrDbNameSql() string
- func (Oracle) GetDSN(params ConnParams) (string, string)
- func (Oracle) QuoteIdent(ident string) string
- func (d Oracle) TableNameSql(dbname string, more bool) string
- func (d Oracle) ViewNameSql(dbname string, more bool) string
- type Postgres
- func (d Postgres) ColumnInfoSql(table, dbname string) string
- func (Postgres) ColumnTypeSql(fullTableName string) string
- func (d Postgres) CurrDbNameSql() string
- func (Postgres) GetDSN(params ConnParams) (string, string)
- func (Postgres) QuoteIdent(ident string) string
- func (d Postgres) TableNameSql(dbname string, more bool) string
- func (d Postgres) ViewNameSql(dbname string, more bool) string
- type Schema
- func (s *Schema) AllTableInfos(dbname string, more bool) map[string]TableInfo
- func (s *Schema) GetColumnExtras(table, dbname string) map[string]ColumnExtra
- func (s *Schema) GetColumnInfos(table, dbname string) []*ColumnInfo
- func (s *Schema) GetColumnTypes(fullTableName string) (cols []*sql.ColumnType)
- func (s *Schema) GetCurrDbName() (dbname string)
- func (s *Schema) GetString(dsql string, offset int) (name string)
- func (s *Schema) GetStrings(dsql string) (names []string)
- func (s *Schema) GetTableInfo(table, dbname string) (tbInfo TableInfo)
- func (s *Schema) GetTableNames(dbname string) (names []string)
- func (s *Schema) GetViewNames(dbname string) (names []string)
- func (s *Schema) ListTable(dbname string, refresh bool) (tables map[string]TableInfo)
- func (s *Schema) Query(fetch FetchFunc, dsql string, args ...interface{}) error
- type Sqlite
- func (d Sqlite) ColumnInfoSql(table, dbname string) string
- func (Sqlite) ColumnTypeSql(fullTableName string) string
- func (Sqlite) CurrDbNameSql() string
- func (Sqlite) GetDSN(params ConnParams) (string, string)
- func (Sqlite) QuoteIdent(ident string) string
- func (d Sqlite) TableNameSql(dbname string, more bool) string
- func (d Sqlite) ViewNameSql(dbname string, more bool) string
- type TableInfo
- type UnknownDriverError
Constants ¶
View Source
const ( IsNotKey IndexKeyType = "" // 普通字段 IndexKey = "MUL" // 普通索引 UniqueKey = "UNI" // 唯一索引 PrimaryKey = "PRI" // 主键 )
索引类型
Variables ¶
View Source
var DefaultColumnExtra = ColumnExtra{DefaultValue: sql.NullString{}}
Functions ¶
func ColumnDefaultValue ¶
Types ¶
type ColumnExtra ¶
type ColumnExtra struct { FieldName string FullType string IndexType IndexKeyType DefaultValue sql.NullString MaxSize int PrecSize, PrecScale int Extra string Comment string }
type ColumnInfo ¶
type ColumnInfo struct { Table *TableInfo *sql.ColumnType ColumnExtra }
func (*ColumnInfo) GetDbType ¶
func (ci *ColumnInfo) GetDbType() string
func (*ColumnInfo) GetDefault ¶
func (ci *ColumnInfo) GetDefault() string
func (*ColumnInfo) GetDefine ¶
func (ci *ColumnInfo) GetDefine() string
func (*ColumnInfo) GetPrecision ¶
func (ci *ColumnInfo) GetPrecision() (int, int)
func (*ColumnInfo) GetSize ¶
func (ci *ColumnInfo) GetSize() int
func (*ColumnInfo) IsIndex ¶
func (ci *ColumnInfo) IsIndex() bool
func (*ColumnInfo) IsNotNull ¶
func (ci *ColumnInfo) IsNotNull() bool
func (*ColumnInfo) IsPrimaryKey ¶
func (ci *ColumnInfo) IsPrimaryKey() bool
type ConnParams ¶
type ConnParams struct { Host string Port int Username string Password string Database string Options map[string]interface{} }
数据库连接配置
func (ConnParams) Concat ¶
func (ConnParams) Concat(master, slave string) string
func (ConnParams) StrPort ¶
func (p ConnParams) StrPort() string
type Dialect ¶
type Dialect interface { GetDSN(params ConnParams) (string, string) QuoteIdent(ident string) string CurrDbNameSql() string TableNameSql(dbname string, more bool) string ViewNameSql(dbname string, more bool) string ColumnTypeSql(fullTableName string) string ColumnInfoSql(table, dbname string) string }
func GetDialectByName ¶
type IndexKeyType ¶
type IndexKeyType string
type Mssql ¶
type Mssql struct { }
func (Mssql) ColumnInfoSql ¶
func (Mssql) ColumnTypeSql ¶
func (Mssql) CurrDbNameSql ¶
func (Mssql) QuoteIdent ¶
type Mysql ¶
type Mysql struct { }
func (Mysql) ColumnInfoSql ¶
func (Mysql) ColumnTypeSql ¶
func (Mysql) CurrDbNameSql ¶
func (Mysql) QuoteIdent ¶
type Oracle ¶
type Oracle struct { }
func (Oracle) ColumnInfoSql ¶
func (Oracle) ColumnTypeSql ¶
func (Oracle) CurrDbNameSql ¶
func (Oracle) QuoteIdent ¶
type Postgres ¶
type Postgres struct { }
func (Postgres) ColumnInfoSql ¶
func (Postgres) ColumnTypeSql ¶
func (Postgres) CurrDbNameSql ¶
func (Postgres) QuoteIdent ¶
type Schema ¶
type Schema struct { DriverName string Dialect Dialect Error error // contains filtered or unexported fields }
func (*Schema) AllTableInfos ¶
func (*Schema) GetColumnExtras ¶
func (s *Schema) GetColumnExtras(table, dbname string) map[string]ColumnExtra
func (*Schema) GetColumnInfos ¶
func (s *Schema) GetColumnInfos(table, dbname string) []*ColumnInfo
func (*Schema) GetColumnTypes ¶
func (s *Schema) GetColumnTypes(fullTableName string) (cols []*sql.ColumnType)
func (*Schema) GetCurrDbName ¶
func (*Schema) GetStrings ¶
func (*Schema) GetTableInfo ¶
func (*Schema) GetTableNames ¶
func (*Schema) GetViewNames ¶
type Sqlite ¶
type Sqlite struct { }
func (Sqlite) ColumnInfoSql ¶
func (Sqlite) ColumnTypeSql ¶
func (Sqlite) CurrDbNameSql ¶
func (Sqlite) QuoteIdent ¶
type TableInfo ¶
type TableInfo struct { DbName string TablePrefix string TableName string TableComment string TableRows int64 Quote func(ident string) string }
表名信息
func (TableInfo) GetFullName ¶
type UnknownDriverError ¶
type UnknownDriverError struct {
Driver string
}
func (UnknownDriverError) Error ¶
func (e UnknownDriverError) Error() string
Click to show internal directories.
Click to hide internal directories.