dbutil

package
v1.3.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCADataSource added in v1.1.0

func GetCADataSource(dbtype, datasource string, cacount int) string

GetCADataSource returns a datasource with a unqiue database name

func MaskDBCred added in v1.0.5

func MaskDBCred(str string) string

MaskDBCred hides DB credentials in connection string

func UpdateDBLevel added in v1.1.0

func UpdateDBLevel(db *DB, levels *Levels) error

UpdateDBLevel updates the levels for the tables in the database

func UpdateSchema added in v1.1.0

func UpdateSchema(db *DB, levels *Levels) error

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

func NewUserRegistrySQLLite3(datasource string) (*DB, error)

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

func (db *DB) IsInitialized() bool

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

type Levels added in v1.1.0

type Levels struct {
	Identity    int
	Affiliation int
	Certificate int
	Credential  int
	RAInfo      int
	Nonce       int
}

Levels contains the levels of identities, affiliations, and certificates

Directories

Path Synopsis
Code generated by mockery v1.0.0.
Code generated by mockery v1.0.0.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL