Versions in this module Expand all Collapse all v0 v0.4.0 Jan 7, 2025 Changes in this version + const ABC + const DeleteStatement + const InsertStatement + const QueryLabel + const ResultRowsLabel + const SelectDistinctStatement + const SelectStatement + const TST + const UpdateStatement + var TokenNotifierCases = []struct{ ... } + var TokensCases = []struct{ ... } + func Close(closer Closer) + func GetTableNames(prefix string) (tableNames, error) + func NewAuditTransactionDB(sqlDB *sql.DB, opts NewDBOpts, ci TokenInterpreter) (driver.AuditTransactionDB, error) + func NewCachedIdentityDB(db *sql.DB, opts NewDBOpts) (driver.IdentityDB, error) + func NewTokenDB(db *sql.DB, opts NewDBOpts, ci TokenInterpreter) (driver.TokenDB, error) + func NewTransactionDB(db *sql.DB, opts NewDBOpts, ci TokenInterpreter) (driver.TokenTransactionDB, error) + func NewWalletDB(db *sql.DB, opts NewDBOpts) (driver.WalletDB, error) + func QueryUnique[T any](db *sql.DB, query string, args ...any) (T, error) + func StartPostgresContainer(t *testing.T) (func(), string) + func StartPostgresWithFmt(configs map[string]*PostgresConfig) (func(), error) + func TCertification(t *testing.T, db *TokenDB) + func TDeleteAndMine(t *testing.T, db *TokenDB) + func TDeleteMultiple(t *testing.T, db *TokenDB) + func TGetTokenInfos(t *testing.T, db *TokenDB) + func TListAuditTokens(t *testing.T, db *TokenDB) + func TListIssuedTokens(t *testing.T, db *TokenDB) + func TPublicParams(t *testing.T, db *TokenDB) + func TQueryTokenDetails(t *testing.T, db *TokenDB) + func TSaveAndGetToken(t *testing.T, db *TokenDB) + func TSubscribeRead(t *testing.T, db driver.TokenDB, notifier driver.TokenNotifier) + func TSubscribeStore(t *testing.T, db driver.TokenDB, notifier driver.TokenNotifier) + func TSubscribeStoreDelete(t *testing.T, db driver.TokenDB, notifier driver.TokenNotifier) + func TSubscribeStoreNoCommit(t *testing.T, db driver.TokenDB, notifier driver.TokenNotifier) + func TTokenTypes(t *testing.T, db *TokenDB) + func TTransaction(t *testing.T, db *TokenDB) + type AtomicWrite struct + func (w *AtomicWrite) AddMovement(r *driver.MovementRecord) error + func (w *AtomicWrite) AddTokenRequest(txID string, tr []byte, applicationMetadata map[string][]byte, ...) error + func (w *AtomicWrite) AddTransaction(r *driver.TransactionRecord) error + func (w *AtomicWrite) AddValidationRecord(txID string, meta map[string][]byte) error + func (w *AtomicWrite) Commit() error + func (w *AtomicWrite) Rollback() + type Closer interface + Close func() error + type DBOpener = Opener[*sql.DB] + func NewSQLDBOpener(optsKey, envVarKey string) *DBOpener + type DataSourceProvider = postgres2.DataSourceProvider + type Delete struct + func NewDeleteFrom(table string) *Delete + func (s *Delete) Compile() (string, error) + func (s *Delete) Where(where string) *Delete + type IdentityConfigurationIterator struct + func (w *IdentityConfigurationIterator) Close() error + func (w *IdentityConfigurationIterator) HasNext() bool + func (w *IdentityConfigurationIterator) Next() (driver.IdentityConfiguration, error) + type IdentityDB struct + func NewIdentityDB(db *sql.DB, tablePrefix string, createSchema bool, signerInfoCache cache[bool], ...) (*IdentityDB, error) + func (db *IdentityDB) AddConfiguration(wp driver.IdentityConfiguration) error + func (db *IdentityDB) ConfigurationExists(id, typ string) (bool, error) + func (db *IdentityDB) GetAuditInfo(id []byte) ([]byte, error) + func (db *IdentityDB) GetSchema() string + func (db *IdentityDB) GetSignerInfo(identity []byte) ([]byte, error) + func (db *IdentityDB) GetTokenInfo(id []byte) ([]byte, []byte, error) + func (db *IdentityDB) IteratorConfigurations(configurationType string) (driver.Iterator[driver.IdentityConfiguration], error) + func (db *IdentityDB) SignerInfoExists(id []byte) (bool, error) + func (db *IdentityDB) StoreIdentityData(id []byte, identityAudit []byte, tokenMetadata []byte, ...) error + func (db *IdentityDB) StoreSignerInfo(id, info []byte) error + type Insert struct + func NewInsertInto(table string) *Insert + func (i *Insert) Compile() (string, error) + func (i *Insert) Rows(rows string) *Insert + type NewDBFunc func(db *sql.DB, opts NewDBOpts) (V, error) + type NewDBOpts struct + CreateSchema bool + DataSource string + TablePrefix string + func NewDBOptsFromOpts(o Opts) NewDBOpts + type OpenDBFunc func(k Opts) (V, error) + type Opener struct + func NewOpenerFromMap[V any](optsKey, envVarKey string, constructors map[common.SQLDriverType]OpenDBFunc[V]) *Opener[V] + func NewOpener[V any](optsKey, envVarKey string, constructors OpenDBFunc[V]) *Opener[V] + func (d *Opener[V]) Open(cp driver.ConfigProvider, tmsID token.TMSID) (V, error) + func (d *Opener[V]) OpenSQLDB(driverName common.SQLDriverType, dataSourceName string, maxOpenConns int, ...) (V, error) + func (d *Opener[V]) OpenWithOpts(cp driver.ConfigProvider, tmsID token.TMSID) (V, *Opts, error) + type Opts = common.Opts + type PostgresConfig = postgres2.ContainerConfig + func DefaultPostgresConfig(node string) *PostgresConfig + type Select struct + func NewSelect(columns ...string) *Select + func NewSelectDistinct(columns ...string) *Select + func (s *Select) Compile() (string, error) + func (s *Select) From(tables ...string) *Select + func (s *Select) OrderBy(orderBy string) *Select + func (s *Select) Where(where string) *Select + type TokenDB struct + func (db *TokenDB) Balance(walletID string, typ token.Type) (uint64, error) + func (db *TokenDB) Close() + func (db *TokenDB) DeleteTokens(deletedBy string, ids ...*token.ID) error + func (db *TokenDB) ExistsCertification(tokenID *token.ID) bool + func (db *TokenDB) GetAllTokenInfos(ids []*token.ID) ([][]byte, error) + func (db *TokenDB) GetCertifications(ids []*token.ID) ([][]byte, error) + func (db *TokenDB) GetSchema() string + func (db *TokenDB) GetTokenMetadata(ids []*token.ID) ([][]byte, error) + func (db *TokenDB) GetTokenOutputs(ids []*token.ID, callback tdriver.QueryCallbackFunc) error + func (db *TokenDB) GetTokenOutputsAndMeta(ctx context.Context, ids []*token.ID) ([][]byte, [][]byte, []token.Format, error) + func (db *TokenDB) GetTokens(inputs ...*token.ID) ([]*token.Token, error) + func (db *TokenDB) IsMine(txID string, index uint64) (bool, error) + func (db *TokenDB) ListAuditTokens(ids ...*token.ID) ([]*token.Token, error) + func (db *TokenDB) ListHistoryIssuedTokens() (*token.IssuedTokens, error) + func (db *TokenDB) ListUnspentTokens() (*token.UnspentTokens, error) + func (db *TokenDB) ListUnspentTokensBy(walletID string, typ token.Type) (*token.UnspentTokens, error) + func (db *TokenDB) NewTokenDBTransaction() (driver.TokenDBTransaction, error) + func (db *TokenDB) PublicParams() ([]byte, error) + func (db *TokenDB) PublicParamsByHash(rawHash tdriver.PPHash) ([]byte, error) + func (db *TokenDB) QueryTokenDetails(params driver.QueryTokenDetailsParams) ([]driver.TokenDetails, error) + func (db *TokenDB) SetSupportedTokenFormats(formats []token.Format) error + func (db *TokenDB) SpendableTokensIteratorBy(ctx context.Context, walletID string, typ token.Type) (tdriver.SpendableTokensIterator, error) + func (db *TokenDB) StoreCertifications(certifications map[*token.ID][]byte) (err error) + func (db *TokenDB) StorePublicParams(raw []byte) error + func (db *TokenDB) StoreToken(tr driver.TokenRecord, owners []string) (err error) + func (db *TokenDB) TransactionExists(ctx context.Context, id string) (bool, error) + func (db *TokenDB) UnspentTokensIterator() (tdriver.UnspentTokensIterator, error) + func (db *TokenDB) UnspentTokensIteratorBy(ctx context.Context, walletID string, tokenType token.Type) (tdriver.UnspentTokensIterator, error) + func (db *TokenDB) WhoDeletedTokens(inputs ...*token.ID) ([]string, []bool, error) + type TokenInterpreter interface + HasMovementsParams func(params driver.QueryMovementsParams) common.Condition + HasTokenDetails func(params driver.QueryTokenDetailsParams, tokenTable string) common.Condition + HasTokenFormats func(colTokenType common.FieldName, formats ...token.Format) common.Condition + HasTokenTypes func(colTokenType common.FieldName, tokenTypes ...token.Type) common.Condition + HasTokens func(colTxID, colIdx common.FieldName, ids ...*token.ID) common.Condition + HasTransactionParams func(params driver.QueryTransactionsParams, table string) common.Condition + HasValidationParams func(params driver.QueryValidationRecordsParams) common.Condition + func NewTokenInterpreter(ci common.Interpreter) TokenInterpreter + type TokenLockDB struct + DB *sql.DB + Logger logging.Logger + Table tokenLockTables + func NewTokenLockDB(db *sql.DB, opts NewDBOpts) (*TokenLockDB, error) + func (db *TokenLockDB) Close() error + func (db *TokenLockDB) GetSchema() string + func (db *TokenLockDB) Lock(tokenID *token.ID, consumerTxID transaction.ID) error + func (db *TokenLockDB) UnlockByTxID(consumerTxID transaction.ID) error + type TokenRequestIterator struct + func (t *TokenRequestIterator) Close() + func (t *TokenRequestIterator) Next() (*driver.TokenRequestRecord, error) + type TokenTransaction struct + func (t *TokenTransaction) Commit() error + func (t *TokenTransaction) Delete(ctx context.Context, tokenID token.ID, deletedBy string) error + func (t *TokenTransaction) GetToken(ctx context.Context, tokenID token.ID, includeDeleted bool) (*token.Token, []string, error) + func (t *TokenTransaction) Rollback() error + func (t *TokenTransaction) SetSpendable(ctx context.Context, tokenID token.ID, spendable bool) error + func (t *TokenTransaction) SetSpendableBySupportedTokenFormats(ctx context.Context, formats []token.Format) error + func (t *TokenTransaction) StoreToken(ctx context.Context, tr driver.TokenRecord, owners []string) error + type TransactionDB struct + func (db *TransactionDB) AddTransactionEndorsementAck(txID string, endorser token.Identity, sigma []byte) (err error) + func (db *TransactionDB) BeginAtomicWrite() (driver.AtomicWrite, error) + func (db *TransactionDB) Close() error + func (db *TransactionDB) GetSchema() string + func (db *TransactionDB) GetStatus(txID string) (driver.TxStatus, string, error) + func (db *TransactionDB) GetTokenRequest(txID string) ([]byte, error) + func (db *TransactionDB) GetTransactionEndorsementAcks(txID string) (map[string][]byte, error) + func (db *TransactionDB) QueryMovements(params driver.QueryMovementsParams) (res []*driver.MovementRecord, err error) + func (db *TransactionDB) QueryTokenRequests(params driver.QueryTokenRequestsParams) (driver.TokenRequestIterator, error) + func (db *TransactionDB) QueryTransactions(params driver.QueryTransactionsParams) (driver.TransactionIterator, error) + func (db *TransactionDB) QueryValidations(params driver.QueryValidationRecordsParams) (driver.ValidationRecordsIterator, error) + func (db *TransactionDB) SetStatus(ctx context.Context, txID string, status driver.TxStatus, message string) (err error) + type TransactionIterator struct + func (t *TransactionIterator) Close() + func (t *TransactionIterator) Next() (*driver.TransactionRecord, error) + type UnspentTokensInWalletIterator struct + func (u *UnspentTokensInWalletIterator) Close() + func (u *UnspentTokensInWalletIterator) Next() (*token.UnspentTokenInWallet, error) + type UnspentTokensIterator struct + func (u *UnspentTokensIterator) Close() + func (u *UnspentTokensIterator) Next() (*token.UnspentToken, error) + type Update struct + func NewUpdate(table string) *Update + func (u *Update) Compile() (string, error) + func (u *Update) Set(rows string) *Update + func (u *Update) Where(where string) *Update + type ValidationRecordsIterator struct + func (t *ValidationRecordsIterator) Close() + func (t *ValidationRecordsIterator) Next() (*driver.ValidationRecord, error) + type WalletDB struct + func (db *WalletDB) GetSchema() string + func (db *WalletDB) GetWalletID(identity token.Identity, roleID int) (driver.WalletID, error) + func (db *WalletDB) GetWalletIDs(roleID int) ([]driver.WalletID, error) + func (db *WalletDB) IdentityExists(identity token.Identity, wID driver.WalletID, roleID int) bool + func (db *WalletDB) LoadMeta(identity token.Identity, wID driver.WalletID, roleID int) ([]byte, error) + func (db *WalletDB) StoreIdentity(identity token.Identity, eID string, wID driver.WalletID, roleID int, ...) error