Documentation ¶
Overview ¶
Go Rtdb Driver - A Rtdb-Driver for Go's database/sql pacakge.
Go Rtdb Driver - A Rtdb-Driver for Go's database/sql pacakge.
Go Rtdb Driver - A Rtdb-Driver for Go's database/sql pacakge.
Index ¶
- Constants
- Variables
- type AtomicBool
- type AtomicError
- type AtomicInt16
- type Config
- type FieldPtr
- type MrFieldPtr
- type ResultSetPtr
- type Row
- type RowsPtr
- type RtdbAdapter
- func (a *RtdbAdapter) CgoConnect() error
- func (a *RtdbAdapter) CgoDisconnect() error
- func (a *RtdbAdapter) CgoFreeResult() error
- func (a *RtdbAdapter) CgoKillMe() error
- func (a *RtdbAdapter) CgoQuery(sql string, charset string, db string) error
- func (a *RtdbAdapter) CgoStoreResult() error
- func (a *RtdbAdapter) CleanUp() error
- func (a *RtdbAdapter) FetchFields() []rtdbField
- func (a *RtdbAdapter) FetchOne() (values []interface{}, err error)
- func (a *RtdbAdapter) IsResultSetEmpty() bool
- func (a *RtdbAdapter) ScanResult() error
- type RtdbDriver
Constants ¶
View Source
const ( MAX_FIELD_COUNT uint32 = 1024 VOID_POINTER_SIZE = unsafe.Sizeof(unsafe.Pointer(nil)) )
View Source
const ( CHARSET_UNKNOWN int8 = iota CHARSET_GBK CHARSET_UTF8 CHARSET_UCS2LE CHARSET_UCS2BE CHARSET_BIG5 CHARSET_EUCJP CHARSET_SJIS CHARSET_EUCKR CHARSET_ISO1 CHARSET_WIN1 CHARSET_WIN2 )
View Source
const ( EPERM = 1 /* Operation not permitted */ ENOENT = 2 /* No such file or directory */ ESRCH = 3 /* No such process */ EINTR = 4 /* Interrupted system call */ ENXIO = 6 /* No such device or address */ E2BIG = 7 /* Argument list too long */ ENOEXEC = 8 /* Exec format error */ EBADF = 9 /* Bad file number */ ECHILD = 10 /* No child processes */ EAGAIN = 11 /* Try again */ ENOMEM = 12 /* Out of memory */ EACCES = 13 /* Permission denied */ EFAULT = 14 /* Bad address */ ENOTBLK = 15 /* Block device required */ EBUSY = 16 /* Device or resource busy */ EEXIST = 17 /* File exists */ EXDEV = 18 /* Cross-device link */ ENODEV = 19 /* No such device */ ENOTDIR = 20 /* Not a directory */ EISDIR = 21 /* Is a directory */ EINVAL = 22 /* Invalid argument */ ENFILE = 23 /* File table overflow */ EMFILE = 24 /* Too many open files */ ENOTTY = 25 /* Not a typewriter */ ETXTBSY = 26 /* Text file busy */ EFBIG = 27 /* File too large */ ENOSPC = 28 /* No space left on device */ ESPIPE = 29 /* Illegal seek */ EROFS = 30 /* Read-only file system */ EMLINK = 31 /* Too many links */ EPIPE = 32 /* Broken pipe */ EDOM = 33 /* Math argument out of domain of func */ ERANGE = 34 /* Math result not representable */ EPROTO = 71 )
Variables ¶
View Source
var ( InvalidConn = errors.New("rtdb: invalid connection") NullPointer = errors.New("rtdb: null pointer") InvalidArgs = errors.New("rtdb: invalid args") OutOfMemory = errors.New("rtdb: out of memory") NoAccess = errors.New("rtdb: insufficient permissions") ProtocolError = errors.New("rtdb: protocol processing error") // TODO: Error should be designed for DSN InvalidDSN = errors.New("rtdb: invalid DSN") )
View Source
var (
DEBUG_PRINT_SQL = true
)
Functions ¶
This section is empty.
Types ¶
type AtomicBool ¶
type AtomicBool uint32
func (*AtomicBool) IsSet ¶
func (b *AtomicBool) IsSet() bool
func (*AtomicBool) Set ¶
func (b *AtomicBool) Set(v bool)
type AtomicError ¶
type AtomicError struct {
// contains filtered or unexported fields
}
func (*AtomicError) Error ¶
func (e *AtomicError) Error() error
func (*AtomicError) Set ¶
func (e *AtomicError) Set(v error)
type AtomicInt16 ¶
type AtomicInt16 struct {
// contains filtered or unexported fields
}
func (AtomicInt16) Get ¶
func (i AtomicInt16) Get() (int16, bool)
func (*AtomicInt16) Set ¶
func (i *AtomicInt16) Set(v int16)
type Config ¶
type Config struct { User string // Username Password string // Password Protocol string // Net protocol type Address string // Network address DBName string // Database name Location *time.Location // Time zone setting DialTimeout time.Duration // Dial timeout ReadTimeout time.Duration // I/O read timeout WriteTimeout time.Duration // I/O write timeout Charset string // Character set Params map[string]string // Connection parameters ParseTime bool // Parse time values to time.Time // contains filtered or unexported fields }
func ParseDSN ¶
ParseDSN parses the dsn+ to a Config. The DSN format is "{user}:{password}@{protocol}({host}:{port})/{dbname}?{param1}={value1}&{param2}={value2}"
func (*Config) HostAndPort ¶
type FieldPtr ¶
type FieldPtr *C.tsdb_v3_field_t
type MrFieldPtr ¶
type MrFieldPtr *C.tsdb_ml_field_t
type ResultSetPtr ¶
type ResultSetPtr *C.RTDB_RES_SET
type Row ¶
type Row C.tsdb_row_t
type RowsPtr ¶
type RowsPtr *C.tsdb_rows_t
type RtdbAdapter ¶
type RtdbAdapter struct {
// contains filtered or unexported fields
}
func NewRtdbAdapter ¶
func NewRtdbAdapter(host string, port int, user string, password string) *RtdbAdapter
func (*RtdbAdapter) CgoConnect ¶
func (a *RtdbAdapter) CgoConnect() error
CgoConnect 使用Cgo调用C函数进行数据库连接
func (*RtdbAdapter) CgoDisconnect ¶
func (a *RtdbAdapter) CgoDisconnect() error
CgoDisconnect 使用Cgo调用C函数断开数据库连接
func (*RtdbAdapter) CgoFreeResult ¶
func (a *RtdbAdapter) CgoFreeResult() error
CgoFreeResult 使用Cgo调用C函数释放查询结果集的内存
func (*RtdbAdapter) CgoKillMe ¶
func (a *RtdbAdapter) CgoKillMe() error
func (*RtdbAdapter) CgoQuery ¶
func (a *RtdbAdapter) CgoQuery(sql string, charset string, db string) error
CgoQuery 使用Cgo调用C函数执行一条数据库查询
func (*RtdbAdapter) CgoStoreResult ¶
func (a *RtdbAdapter) CgoStoreResult() error
CgoStoreResult 使用Cgo调用C函数获取查询的结果集
func (*RtdbAdapter) FetchFields ¶
func (a *RtdbAdapter) FetchFields() []rtdbField
FetchFields 获取数据库列的信息
func (*RtdbAdapter) FetchOne ¶
func (a *RtdbAdapter) FetchOne() (values []interface{}, err error)
FetchOne 使用Cgo调用获取结果集的C函数,然后将C数据库结构转换为Go数据类型.
func (*RtdbAdapter) IsResultSetEmpty ¶
func (a *RtdbAdapter) IsResultSetEmpty() bool
func (*RtdbAdapter) ScanResult ¶
func (a *RtdbAdapter) ScanResult() error
type RtdbDriver ¶
type RtdbDriver struct{}
func (RtdbDriver) OpenConnector ¶
func (rd RtdbDriver) OpenConnector(dsn string) (driver.Connector, error)
Click to show internal directories.
Click to hide internal directories.