Documentation ¶
Index ¶
- Variables
- func CheckDatabaseExist(db *XDb, name string, driver string) bool
- func CheckRecordExist(db *XDb, sql string, driver string) bool
- func CheckRecordExistByTx(db *MyTx, sql string, driver string) bool
- func CheckSqliteTableExist(db *XDb, tableName string) bool
- func CheckTableExist(db *XDb, name string, driver string) bool
- func CreateTableFromStruct(dbType string, tbName string, engine string, inf interface{}, args ...string) (string, error)
- func GetDBFieldType(row *MyRows) (map[string]*MyFieldType, bool)
- func MysqlCreateTableFromStruct(tbName string, engine string, inf interface{}, args ...string) (string, error)
- func MysqlFillStruct(rows *MyRows, inf interface{}) error
- func MysqlInsertTableFromStruct(tbName string, inf interface{}, skip map[string]string) (string, error)
- func MysqlInsertTableFromStructByValues(tbName string, inf interface{}, skip map[string]string) (string, error)
- func MysqlUpdateTableFromStruct(tbName string, inf interface{}, where string, skip map[string]string) (string, error)
- func RowToModel(row IGetData, m interface{}) error
- func SetFieldValue(row IGetData, tabinfo *TableInfo) (err error)
- func SetValue(row IGetData, model interface{}) (err error)
- func SqlLiteCreateTableFromStruct(tbName string, engine string, inf interface{}, args ...string) (string, []string, error)
- type DataRow
- func (me *DataRow) Bool(strFieldName string) bool
- func (me *DataRow) Bytes(strFieldName string) []byte
- func (me *DataRow) Float(strFieldName string) float32
- func (me *DataRow) Float32(strFieldName string) float32
- func (me *DataRow) Float64(strFieldName string) float64
- func (me *DataRow) GetValue(name string, value interface{}) error
- func (me *DataRow) Int(strFieldName string) int
- func (me *DataRow) Int16(strFieldName string) int16
- func (me *DataRow) Int32(strFieldName string) int32
- func (me *DataRow) Int64(strFieldName string) int64
- func (me *DataRow) Int8(strFieldName string) int8
- func (me *DataRow) String(strFieldName string) string
- func (me *DataRow) Time(strFieldName string) time.Time
- func (me *DataRow) Uint(strFieldName string) uint
- func (me *DataRow) Uint16(strFieldName string) uint16
- func (me *DataRow) Uint32(strFieldName string) uint32
- func (me *DataRow) Uint64(strFieldName string) uint64
- func (me *DataRow) Uint8(strFieldName string) uint8
- type FieldInfo
- type IGetData
- type MyFieldType
- type MyRow
- func (me *MyRow) Bool(strFieldName string) bool
- func (me *MyRow) Bytes(strFieldName string) []byte
- func (me *MyRow) Float(strFieldName string) float32
- func (me *MyRow) Float32(strFieldName string) float32
- func (me *MyRow) Float64(strFieldName string) float64
- func (me *MyRow) GetValue(name string, value interface{}) error
- func (me *MyRow) Int(strFieldName string) int
- func (me *MyRow) Int16(strFieldName string) int16
- func (me *MyRow) Int32(strFieldName string) int32
- func (me *MyRow) Int64(strFieldName string) int64
- func (me *MyRow) Int8(strFieldName string) int8
- func (me *MyRow) Scan(dest ...interface{}) error
- func (me *MyRow) String(strFieldName string) string
- func (me *MyRow) Time(strFieldName string) time.Time
- func (me *MyRow) Uint(strFieldName string) uint
- func (me *MyRow) Uint16(strFieldName string) uint16
- func (me *MyRow) Uint32(strFieldName string) uint32
- func (me *MyRow) Uint64(strFieldName string) uint64
- func (me *MyRow) Uint8(strFieldName string) uint8
- type MyRows
- func (me *MyRows) Bool(strFieldName string) bool
- func (me *MyRows) Bytes(strFieldName string) []byte
- func (me *MyRows) Close() error
- func (me *MyRows) Float(strFieldName string) float32
- func (me *MyRows) Float32(strFieldName string) float32
- func (me *MyRows) Float64(strFieldName string) float64
- func (me *MyRows) GetCreateTime() int64
- func (me *MyRows) GetFields() []string
- func (me *MyRows) GetOrgValue(name string) (interface{}, bool)
- func (me *MyRows) GetValue(name string, value interface{}) error
- func (me *MyRows) GetValueByIndex(index int, value interface{}) error
- func (me *MyRows) GetValues() map[string]interface{}
- func (me *MyRows) Int(strFieldName string) int
- func (me *MyRows) Int16(strFieldName string) int16
- func (me *MyRows) Int32(strFieldName string) int32
- func (me *MyRows) Int64(strFieldName string) int64
- func (me *MyRows) Int8(strFieldName string) int8
- func (me *MyRows) IsNULL(name string) bool
- func (me *MyRows) Next() bool
- func (me *MyRows) SaveFields()
- func (me *MyRows) Scan(dest ...interface{}) error
- func (me *MyRows) SetNoCase(enable bool)
- func (me *MyRows) String(strFieldName string) string
- func (me *MyRows) Time(strFieldName string) time.Time
- func (me *MyRows) Uint(strFieldName string) uint
- func (me *MyRows) Uint16(strFieldName string) uint16
- func (me *MyRows) Uint32(strFieldName string) uint32
- func (me *MyRows) Uint64(strFieldName string) uint64
- func (me *MyRows) Uint8(strFieldName string) uint8
- type MyStmt
- type MyTx
- func (me *MyTx) DBQueryAll(sql string, args ...interface{}) ([]map[string]interface{}, error)
- func (me *MyTx) DBQueryAllField(sql string, args ...interface{}) ([]string, []map[string]interface{}, error)
- func (me *MyTx) Prepare(query string) (*MyStmt, error)
- func (me *MyTx) Query(query string, args ...interface{}) (*MyRows, error)
- func (me *MyTx) QueryRow(query string, args ...interface{}) (*MyRow, error)
- type TableInfo
- type TableName
- type XDBInf
- type XDb
- func OpenAdo(host, dbName, user, pwd string) (*XDb, error)
- func OpenAdoSQL(host, dbName, user, pwd string) (*XDb, error)
- func OpenMssql(host, dbName, user, pwd string) (*XDb, error)
- func OpenMssqlOdbc(host, dbName, user, pwd string) (*XDb, error)
- func OpenMyado(host, dbName, user, pwd string) (*XDb, error)
- func OpenMysql(host, dbName, user, pwd, charset string) (*XDb, error)
- func OpenNetsql(host, dbName, user, pwd string) (*XDb, error)
- func OpenODBC(connStr string) (*XDb, error)
- func OpenODBCDSN(user, pwd, dsn string) (*XDb, error)
- func OpenOrcl(host, dbName, user, pwd string) (*XDb, error)
- func OpenOrclDror(host, dbName, user, pwd string) (*XDb, error)
- func OpenOrclGo(host, dbName, user, pwd string, inputConnStr string) (*XDb, error)
- func OpenSqlLite3(filename string) (*XDb, error)
- func (me *XDb) Begin() (*MyTx, error)
- func (me *XDb) DBQueryAll(sql string, args ...interface{}) ([]map[string]interface{}, error)
- func (me *XDb) DBQueryAllField(sql string, args ...interface{}) ([]string, []map[string]interface{}, error)
- func (me *XDb) Delete(model interface{}) (int64, error)
- func (me *XDb) Exec(query string, args ...interface{}) (sql.Result, error)
- func (me *XDb) GetCallInfo() []byte
- func (me *XDb) GetDBName() string
- func (me *XDb) GetMysqlErrno(err error) int
- func (me *XDb) GetRowMap() map[uint64]*MyRows
- func (me *XDb) Insert(model interface{}) error
- func (me *XDb) Load(model interface{}) error
- func (me *XDb) Lock()
- func (me *XDb) Prepare(query string) (*MyStmt, error)
- func (me *XDb) Query(query string, args ...interface{}) (*MyRows, error)
- func (me *XDb) QueryCount(query string, args ...interface{}) int
- func (me *XDb) QueryDataRows(query string, args ...interface{}) ([]DataRow, error)
- func (me *XDb) QueryRow(query string, args ...interface{}) (*MyRow, error)
- func (me *XDb) SetMaxOpenConns(n int)
- func (me *XDb) Unlock()
- func (me *XDb) Update(model interface{}) (int64, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNoRows = errors.New("sql: no rows in result set")
Functions ¶
func CheckSqliteTableExist ¶
func CreateTableFromStruct ¶
func GetDBFieldType ¶
func GetDBFieldType(row *MyRows) (map[string]*MyFieldType, bool)
func MysqlFillStruct ¶
func RowToModel ¶
func SetFieldValue ¶
取数据赋给对应的struct里的字段
Types ¶
type DataRow ¶
type DataRow struct {
// contains filtered or unexported fields
}
type MyFieldType ¶
type MyRow ¶
type MyRow struct { IsHasRows bool //true表示有数据,false没数据 // contains filtered or unexported fields }
type MyRows ¶
func (*MyRows) GetCreateTime ¶
func (*MyRows) GetOrgValue ¶
func (*MyRows) GetValueByIndex ¶
func (*MyRows) SaveFields ¶
func (me *MyRows) SaveFields()
type XDb ¶
func OpenAdoSQL ¶
func OpenMssqlOdbc ¶
access "Driver={microsoft access driver(*.mdb)};dbq=*.mdb;uid=admin;pwd=pass;" dBase "Driver={microsoft dbase driver(*.dbf)};driverid=277;dbq=------------;" oracle "Driver={microsoft odbc for oracle};server=oraclesever.world;uid=admin;pwd=pass;" MSSQL server "Driver={sql server};server=servername;database=dbname;uid=sa;pwd=pass;" MS text "Driver={microsoft text driver(*.txt; *.csv)};dbq=-----;extensions=asc,csv,tab,txt;Persist SecurityInfo=false;"
Visual Foxpro "Driver={microsoft Visual Foxpro driver};sourcetype=DBC;sourceDB=*.dbc;Exclusive=No;"
MySQL "Driver={mysql};database=yourdatabase;uid=username;pwd=yourpassword;option=16386;"
SQLite "Driver={SQLite3 ODBC Driver};Database=D:\SQLite\*.db"
PostgreSQL "Driver={PostgreSQL ANSI};server=127.0.0.1;uid=admin;pwd=pass;database=databaseName"
func OpenNetsql ¶
db, err := dataset.OpenNetsql("58.221.46.81:1209", "dada", "129129")
func OpenODBCDSN ¶
func OpenOrclDror ¶
`user="scott" password="tiger" connectString="dbhost:1521/orclpdb1"`