sqlite

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: Apache-2.0 Imports: 10 Imported by: 17 modules, 42 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Create

type Create interface {
	Exec(funcName, query string, args ...interface{}) (sql.Result, error)
	Rebind(query string) string
	Rollback(funcName string) error
	Commit(funcName string) error
}

Create is interface that defines functions need to create database transaction

type Migrator

type Migrator struct {
	Tx        db.FabricCATx
	CurLevels *util.Levels
	SrvLevels *util.Levels
}

Migrator defines migrator

func NewMigrator

func NewMigrator(tx db.FabricCATx, curLevels, srvLevels *util.Levels) *Migrator

NewMigrator returns a migrator instance

func (*Migrator) Commit

func (m *Migrator) Commit() error

Commit is responsible for committing the migration db transcation

func (*Migrator) MigrateAffiliationsTable

func (m *Migrator) MigrateAffiliationsTable() error

MigrateAffiliationsTable is responsible for migrating affiliations table SQLite has limited support for altering table columns, to upgrade the schema we require renaming the current affiliations table to affiliations_old and then creating a new user table using the new schema definition. Next, we proceed to copy the data from the old table to new table, and then drop the old table.

func (*Migrator) MigrateCertificatesTable

func (m *Migrator) MigrateCertificatesTable() error

MigrateCertificatesTable is responsible for migrating certificates table SQLite has limited support for altering table columns, to upgrade the schema we require renaming the current certificates table to certificates_old and then creating a new certificates table using the new schema definition. Next, we proceed to copy the data from the old table to new table, and then drop the old table.

func (*Migrator) MigrateCredentialsTable

func (m *Migrator) MigrateCredentialsTable() error

MigrateCredentialsTable is responsible for migrating credentials table

func (*Migrator) MigrateNoncesTable

func (m *Migrator) MigrateNoncesTable() error

MigrateNoncesTable is responsible for migrating nonces table

func (*Migrator) MigrateRAInfoTable

func (m *Migrator) MigrateRAInfoTable() error

MigrateRAInfoTable is responsible for migrating rainfo table

func (*Migrator) MigrateUsersTable

func (m *Migrator) MigrateUsersTable() error

MigrateUsersTable is responsible for migrating users table

func (*Migrator) Rollback

func (m *Migrator) Rollback() error

Rollback is responsible for rollback transaction if an error is encountered

type Sqlite

type Sqlite struct {
	SqlxDB   db.FabricCADB
	CreateTx Create
	CAName   string
	Metrics  *db.Metrics
	// contains filtered or unexported fields
}

Sqlite defines SQLite database

func NewDB

func NewDB(datasource, caName string, metrics *db.Metrics) *Sqlite

NewDB creates a SQLite database

func (*Sqlite) Connect

func (s *Sqlite) Connect() error

Connect connects to a SQLite database

func (*Sqlite) Create

func (s *Sqlite) Create() (*db.DB, error)

Create creates database and tables

func (*Sqlite) CreateTables

func (s *Sqlite) CreateTables() error

CreateTables creates table

func (*Sqlite) PingContext

func (s *Sqlite) PingContext(ctx context.Context) error

PingContext pings the database

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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