Versions in this module Expand all Collapse all v3 v3.0.1 Dec 26, 2023 v3.0.0 Dec 23, 2022 Changes in this version + const DbType_MySQL + const DbType_Sqlite + const DbType_TDSQL + const DsnParsetime + const Utf8Char + var ErrConnection = errors.New("database connect error") + var ErrDatabase = errors.New("database operation error") + var ErrIO = errors.New("database I/O error") + var ErrNoRowExist = errors.New("no row exist") + var ErrRow = errors.New("table row query error") + var ErrSql = errors.New("sql error") + var ErrSqlQuery = errors.New("sql query error") + var ErrTable = errors.New("table operation error") + var ErrTransaction = errors.New("database transaction error") + var ErrTxNotFound = errors.New("transaction not found") + var ErrTypeConvert = errors.New("type convert error") + func ParseSqlDbType(str string) (string, error) + type KeyValue struct + ObjectKey []byte + ObjectValue []byte + func (kv *KeyValue) GetCountSql() (string, []interface{}) + func (kv *KeyValue) GetCreateTableSql(dbType string) string + func (kv *KeyValue) GetInsertSql(dbType string) (string, []interface{}) + func (kv *KeyValue) GetSaveSql(dbType string) (string, []interface{}) + func (kv *KeyValue) GetTableName() string + func (kv *KeyValue) GetUpdateSql() (string, []interface{}) + type NewSqlDBOptions struct + ChainId string + Config *SqlDbConfig + DbName string + Encryptor crypto.SymmetricKey + Logger protocol.Logger + type SqlDBHandle struct + func NewKVDBHandle(input *NewSqlDBOptions) *SqlDBHandle + func NewMemSqlDBHandle(log protocol.Logger) *SqlDBHandle + func NewShareMemSqlDBHandle(log protocol.Logger) *SqlDBHandle + func NewSqlDBHandle(input *NewSqlDBOptions) *SqlDBHandle + func (p *SqlDBHandle) BeginDbTransaction(txName string) (protocol.SqlDBTransaction, error) + func (p *SqlDBHandle) Close() error + func (p *SqlDBHandle) CommitDbTransaction(txName string) error + func (p *SqlDBHandle) CompactRange(start, limit []byte) error + func (p *SqlDBHandle) CreateDatabaseIfNotExist(dbName string) (bool, error) + func (p *SqlDBHandle) CreateTable(obj TableDDLGenerator) error + func (p *SqlDBHandle) CreateTableIfNotExist(objI interface{}) error + func (p *SqlDBHandle) Delete(key []byte) error + func (p *SqlDBHandle) Dump(dumpDir string, fileNamePre string) (string, error) + func (p *SqlDBHandle) ExecSql(sql string, values ...interface{}) (int64, error) + func (p *SqlDBHandle) Get(key []byte) ([]byte, error) + func (p *SqlDBHandle) GetDbTransaction(txName string) (protocol.SqlDBTransaction, error) + func (p *SqlDBHandle) GetDbType() string + func (p *SqlDBHandle) GetKeys(keys [][]byte) ([][]byte, error) + func (p *SqlDBHandle) GetSqlDbType() string + func (p *SqlDBHandle) GetWriteBatchSize() uint64 + func (p *SqlDBHandle) Has(key []byte) (bool, error) + func (p *SqlDBHandle) HasTable(tableName string) (bool, error) + func (p *SqlDBHandle) NewIteratorWithPrefix(prefix []byte) (protocol.Iterator, error) + func (p *SqlDBHandle) NewIteratorWithRange(start []byte, limit []byte) (protocol.Iterator, error) + func (p *SqlDBHandle) Put(key []byte, value []byte) error + func (p *SqlDBHandle) QueryMulti(sql string, values ...interface{}) (protocol.SqlRows, error) + func (p *SqlDBHandle) QuerySingle(sql string, values ...interface{}) (protocol.SqlRow, error) + func (p *SqlDBHandle) RollbackDbTransaction(txName string) error + func (p *SqlDBHandle) Save(val interface{}) (int64, error) + func (p *SqlDBHandle) WriteBatch(batch protocol.StoreBatcher, sync bool) error + type SqlDBRow struct + func NewSqlDBRow(row *sql.Rows) *SqlDBRow + func (r *SqlDBRow) ScanColumns(dest ...interface{}) error + func (row *SqlDBRow) Data() (map[string][]byte, error) + func (row *SqlDBRow) IsEmpty() bool + type SqlDBRows struct + func NewSqlDBRows(rows *sql.Rows, close func() error) *SqlDBRows + func (r *SqlDBRows) Close() error + func (r *SqlDBRows) Data() (map[string][]byte, error) + func (r *SqlDBRows) Next() bool + func (r *SqlDBRows) ScanColumns(dest ...interface{}) error + type SqlDBTx struct + func NewSqlDBTx(name string, dbType string, db *sql.Tx, logger protocol.Logger) *SqlDBTx + func (p *SqlDBTx) BeginDbSavePoint(spName string) error + func (p *SqlDBTx) ChangeContextDb(dbName string) error + func (p *SqlDBTx) Commit() error + func (p *SqlDBTx) ExecSql(sql string, values ...interface{}) (int64, error) + func (p *SqlDBTx) QueryMulti(sql string, values ...interface{}) (protocol.SqlRows, error) + func (p *SqlDBTx) QuerySingle(sql string, values ...interface{}) (protocol.SqlRow, error) + func (p *SqlDBTx) Rollback() error + func (p *SqlDBTx) RollbackDbSavePoint(spName string) error + func (p *SqlDBTx) Save(val interface{}) (int64, error) + func (p *SqlDBTx) SaveBatch(vals []interface{}) (int64, error) + type SqlDbConfig struct + ConnMaxLifeTime int + DbPrefix string + Dsn string + MaxIdleConns int + MaxOpenConns int + SqlDbType string + SqlLogMode string + SqlVerifier string + type TableDDLGenerator interface + GetCreateTableSql func(dbType string) string + GetTableName func() string + type TableDMLGenerator interface + GetCountSql func() (string, []interface{}) + GetInsertSql func(dbType string) (string, []interface{}) + GetUpdateSql func() (string, []interface{}) + type UserDefineSave interface + GetSaveSql func(dbType string) (string, []interface{}) Other modules containing this package chainmaker.org/chainmaker/store-sqldb/v2