Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCADataSource ¶ added in v1.1.0
GetCADataSource returns a datasource with a unqiue database name
func MaskDBCred ¶ added in v1.0.5
MaskDBCred hides DB credentials in connection string
func UpdateDBLevel ¶ added in v1.1.0
UpdateDBLevel updates the levels for the tables in the database
func UpdateSchema ¶ added in v1.1.0
UpdateSchema updates the database tables to use the latest schema
Types ¶
type DB ¶ added in v1.2.0
type DB struct { *sqlx.DB // Indicates if database was successfully initialized IsDBInitialized bool }
DB is an adapter for sqlx.DB and implements FabricCADB interface
func NewUserRegistryMySQL ¶
func NewUserRegistryMySQL(datasource string, clientTLSConfig *tls.ClientTLSConfig, csp bccsp.BCCSP) (*DB, error)
NewUserRegistryMySQL opens a connection to a postgres database
func NewUserRegistryPostgres ¶
func NewUserRegistryPostgres(datasource string, clientTLSConfig *tls.ClientTLSConfig) (*DB, error)
NewUserRegistryPostgres opens a connection to a postgres database
func NewUserRegistrySQLLite3 ¶
NewUserRegistrySQLLite3 returns a pointer to a sqlite database
func (*DB) BeginTx ¶ added in v1.2.0
func (db *DB) BeginTx() FabricCATx
BeginTx implements BeginTx method of FabricCADB interface
func (*DB) IsInitialized ¶ added in v1.2.0
IsInitialized returns true if db is intialized, else false
type FabricCADB ¶ added in v1.2.0
type FabricCADB interface { IsInitialized() bool Select(dest interface{}, query string, args ...interface{}) error Exec(query string, args ...interface{}) (sql.Result, error) NamedExec(query string, arg interface{}) (sql.Result, error) Rebind(query string) string MustBegin() *sqlx.Tx // BeginTx has same behavior as MustBegin except it returns FabricCATx // instead of *sqlx.Tx BeginTx() FabricCATx }
FabricCADB is the interface with functions implemented by sqlx.DB object that are used by Fabric CA server
type FabricCATx ¶ added in v1.2.0
type FabricCATx interface { Select(dest interface{}, query string, args ...interface{}) error Rebind(query string) string Exec(query string, args ...interface{}) (sql.Result, error) Commit() error Rollback() error }
FabricCATx is the interface with functions implemented by sqlx.Tx object that are used by Fabric CA server