Documentation
¶
Overview ¶
File is part of the build only if cgo is enabled. Otherwise, the compilation will complains about missing type sqlite3,Error It is due to the fact than sqlite lib use import "C" statement. The presence of these statement during the build exclude the file if CGO is disabled.
Index ¶
- Constants
- Variables
- func DriverModule(cfg ModuleConfig) fx.Option
- func InstrumentalizeSQLDrivers()
- func Migrate(ctx context.Context, schema Schema, migrations ...Migration) (bool, error)
- func NewDefaultStorageDriverFromRawDriver(driver *Driver) storage.Driver[storage.LedgerStore]
- func NewIdempotencyStorageDriverFromRawDriver(driver *Driver) storage.Driver[idempotency.Store]
- func NewLedgerStorageDriverFromRawDriver(driver *Driver) storage.Driver[ledger.Store]
- func NewPostgresDB(db *sql.DB) *postgresDB
- func NewSQLiteDB(directory, dbName string) *sqliteDB
- func OpenSQLDB(flavor Flavor, dataSourceName string) (*sql.DB, error)
- func RegisterGoMigration(fn MigrationFunc)
- func RegisterGoMigrationFromFilename(filename string, fn MigrationFunc)
- func UpdateSQLDriverMapping(flavor Flavor, name string)
- type AccPaginationToken
- type BalancesPaginationToken
- type DB
- type DefaultStorageDriver
- type Driver
- type Flavor
- type HandlersByEngine
- type IdempotencyStorageDriver
- type LedgerStorageDriver
- type LogsPaginationToken
- type Migration
- type MigrationFunc
- type Migrations
- type ModuleConfig
- type PGSchema
- func (s *PGSchema) Close(ctx context.Context) error
- func (s *PGSchema) Delete(ctx context.Context) error
- func (s *PGSchema) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (s *PGSchema) Flavor() sqlbuilder.Flavor
- func (s *PGSchema) Initialize(ctx context.Context) error
- func (s *PGSchema) Name() string
- func (s *PGSchema) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (s *PGSchema) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (s *PGSchema) Table(name string) string
- type PostgresConfig
- type SQLiteConfig
- type SQLiteSchema
- func (s *SQLiteSchema) Close(ctx context.Context) error
- func (s SQLiteSchema) Delete(ctx context.Context) error
- func (s *SQLiteSchema) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (s SQLiteSchema) Flavor() sqlbuilder.Flavor
- func (s *SQLiteSchema) Initialize(ctx context.Context) error
- func (s *SQLiteSchema) Name() string
- func (s *SQLiteSchema) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (s *SQLiteSchema) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (s *SQLiteSchema) Table(name string) string
- type Schema
- type Store
- func (s *Store) Close(ctx context.Context) error
- func (s *Store) Commit(ctx context.Context, txs ...core.ExpandedTransaction) (err error)
- func (s *Store) CountAccounts(ctx context.Context, q ledger.AccountsQuery) (uint64, error)
- func (s *Store) CountTransactions(ctx context.Context, q ledger.TransactionsQuery) (uint64, error)
- func (s *Store) CreateIK(ctx context.Context, key string, response idempotency.Response) error
- func (s *Store) Delete(ctx context.Context) error
- func (s *Store) GetAccount(ctx context.Context, addr string) (*core.Account, error)
- func (s *Store) GetAccountWithVolumes(ctx context.Context, address string) (*core.AccountWithVolumes, error)
- func (s *Store) GetAccounts(ctx context.Context, q ledger.AccountsQuery) (api.Cursor[core.Account], error)
- func (s *Store) GetAssetsVolumes(ctx context.Context, accountAddress string) (core.AssetsVolumes, error)
- func (s *Store) GetBalances(ctx context.Context, q ledger.BalancesQuery) (api.Cursor[core.AccountsBalances], error)
- func (s *Store) GetBalancesAggregated(ctx context.Context, q ledger.AggregatedBalancesQuery) (core.AssetsBalances, error)
- func (s *Store) GetLastLog(ctx context.Context) (*core.Log, error)
- func (s *Store) GetLastTransaction(ctx context.Context) (*core.ExpandedTransaction, error)
- func (s *Store) GetLogs(ctx context.Context, q *ledger.LogsQuery) (api.Cursor[core.Log], error)
- func (s *Store) GetMigrationsAvailable() ([]core.MigrationInfo, error)
- func (s *Store) GetMigrationsDone(ctx context.Context) ([]core.MigrationInfo, error)
- func (s *Store) GetTransaction(ctx context.Context, txId uint64) (*core.ExpandedTransaction, error)
- func (s *Store) GetTransactions(ctx context.Context, q ledger.TransactionsQuery) (api.Cursor[core.ExpandedTransaction], error)
- func (s *Store) Initialize(ctx context.Context) (bool, error)
- func (s *Store) LoadMapping(ctx context.Context) (*core.Mapping, error)
- func (s *Store) Name() string
- func (s *Store) ReadIK(ctx context.Context, key string) (*idempotency.Response, error)
- func (s *Store) SaveMapping(ctx context.Context, mapping core.Mapping) error
- func (s *Store) Schema() Schema
- func (s *Store) UpdateAccountMetadata(ctx context.Context, address string, metadata core.Metadata, at time.Time) error
- func (s *Store) UpdateTransactionMetadata(ctx context.Context, id uint64, metadata core.Metadata, at time.Time) error
- type SystemStore
- func (s SystemStore) DeleteLedger(ctx context.Context, name string) error
- func (s *SystemStore) GetConfiguration(ctx context.Context, key string) (string, error)
- func (s SystemStore) InsertConfiguration(ctx context.Context, key, value string) error
- func (s SystemStore) ListLedgers(ctx context.Context) ([]string, error)
- func (s *SystemStore) Register(ctx context.Context, ledger string) (bool, error)
- type TxsPaginationToken
Constants ¶
View Source
const (
SQLCustomFuncMetaCompare = "meta_compare"
)
View Source
const SystemSchema = "_system"
Variables ¶
View Source
var ( SQLite = Flavor(sqlbuilder.SQLite) PostgreSQL = Flavor(sqlbuilder.PostgreSQL) )
View Source
var MigrationsFS embed.FS
Functions ¶
func DriverModule ¶
func DriverModule(cfg ModuleConfig) fx.Option
func InstrumentalizeSQLDrivers ¶ added in v1.9.0
func InstrumentalizeSQLDrivers()
func NewDefaultStorageDriverFromRawDriver ¶ added in v1.8.0
func NewDefaultStorageDriverFromRawDriver(driver *Driver) storage.Driver[storage.LedgerStore]
func NewIdempotencyStorageDriverFromRawDriver ¶ added in v1.8.0
func NewIdempotencyStorageDriverFromRawDriver(driver *Driver) storage.Driver[idempotency.Store]
func NewLedgerStorageDriverFromRawDriver ¶ added in v1.8.0
func NewPostgresDB ¶ added in v1.3.2
func NewSQLiteDB ¶ added in v1.3.2
func NewSQLiteDB(directory, dbName string) *sqliteDB
func RegisterGoMigration ¶ added in v1.7.0
func RegisterGoMigration(fn MigrationFunc)
func RegisterGoMigrationFromFilename ¶ added in v1.7.0
func RegisterGoMigrationFromFilename(filename string, fn MigrationFunc)
func UpdateSQLDriverMapping ¶
Types ¶
type AccPaginationToken ¶ added in v1.3.2
type AccPaginationToken struct { PageSize uint `json:"pageSize"` Offset uint `json:"offset"` AfterAddress string `json:"after,omitempty"` AddressRegexpFilter string `json:"address,omitempty"` MetadataFilter map[string]string `json:"metadata,omitempty"` BalanceFilter string `json:"balance,omitempty"` BalanceOperatorFilter ledger.BalanceOperator `json:"balanceOperator,omitempty"` }
type BalancesPaginationToken ¶ added in v1.6.0
type DefaultStorageDriver ¶ added in v1.8.0
type DefaultStorageDriver struct {
*Driver
}
func (*DefaultStorageDriver) GetLedgerStore ¶ added in v1.8.0
func (d *DefaultStorageDriver) GetLedgerStore(ctx context.Context, name string, create bool) (storage.LedgerStore, bool, error)
type Driver ¶ added in v1.3.2
type Driver struct {
// contains filtered or unexported fields
}
func (*Driver) GetLedgerStore ¶ added in v1.8.0
func (*Driver) GetSystemStore ¶ added in v1.8.0
func (d *Driver) GetSystemStore() storage.SystemStore
func (*Driver) Initialize ¶ added in v1.3.2
type HandlersByEngine ¶ added in v1.7.0
type HandlersByEngine map[string][]MigrationFunc
type IdempotencyStorageDriver ¶ added in v1.8.0
type IdempotencyStorageDriver struct {
*Driver
}
func (*IdempotencyStorageDriver) GetLedgerStore ¶ added in v1.8.0
func (d *IdempotencyStorageDriver) GetLedgerStore(ctx context.Context, name string, create bool) (idempotency.Store, bool, error)
type LedgerStorageDriver ¶ added in v1.8.0
type LedgerStorageDriver struct {
*Driver
}
type LogsPaginationToken ¶ added in v1.9.0
type Migration ¶ added in v1.7.0
type Migration struct { core.MigrationInfo `json:"inline"` Handlers HandlersByEngine `json:"-"` }
type MigrationFunc ¶ added in v1.7.0
func SQLMigrationFunc ¶ added in v1.7.0
func SQLMigrationFunc(content string) MigrationFunc
type Migrations ¶ added in v1.7.0
type Migrations []Migration
func (Migrations) Len ¶ added in v1.7.0
func (m Migrations) Len() int
func (Migrations) Less ¶ added in v1.7.0
func (m Migrations) Less(i, j int) bool
func (Migrations) Swap ¶ added in v1.7.0
func (m Migrations) Swap(i, j int)
type ModuleConfig ¶
type ModuleConfig struct { StorageDriver string SQLiteConfig *SQLiteConfig PostgresConfig *PostgresConfig RedisLockStrategy bool }
type PGSchema ¶ added in v1.3.2
type PGSchema struct {
// contains filtered or unexported fields
}
func (*PGSchema) ExecContext ¶ added in v1.3.2
func (*PGSchema) Initialize ¶ added in v1.3.2
func (*PGSchema) QueryContext ¶ added in v1.3.2
func (*PGSchema) QueryRowContext ¶ added in v1.3.2
type PostgresConfig ¶
type PostgresConfig struct {
ConnString string
}
type SQLiteConfig ¶
type SQLiteSchema ¶ added in v1.3.2
type SQLiteSchema struct {
// contains filtered or unexported fields
}
func (SQLiteSchema) Delete ¶ added in v1.3.2
func (s SQLiteSchema) Delete(ctx context.Context) error
func (*SQLiteSchema) ExecContext ¶ added in v1.3.2
func (SQLiteSchema) Flavor ¶ added in v1.3.2
func (s SQLiteSchema) Flavor() sqlbuilder.Flavor
func (*SQLiteSchema) Initialize ¶ added in v1.3.2
func (*SQLiteSchema) QueryContext ¶ added in v1.3.2
func (*SQLiteSchema) QueryRowContext ¶ added in v1.3.2
type Schema ¶ added in v1.3.2
type Schema interface { Initialize(ctx context.Context) error Table(name string) string Close(ctx context.Context) error BeginTx(ctx context.Context, s *sql.TxOptions) (*sql.Tx, error) Flavor() sqlbuilder.Flavor Name() string Delete(ctx context.Context) error // contains filtered or unexported methods }
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) CountAccounts ¶
func (*Store) CountTransactions ¶
func (*Store) GetAccount ¶ added in v1.3.2
func (*Store) GetAccountWithVolumes ¶ added in v1.9.0
func (*Store) GetAccounts ¶ added in v1.3.2
func (*Store) GetAssetsVolumes ¶ added in v1.6.0
func (*Store) GetBalances ¶ added in v1.6.0
func (s *Store) GetBalances(ctx context.Context, q ledger.BalancesQuery) (api.Cursor[core.AccountsBalances], error)
func (*Store) GetBalancesAggregated ¶ added in v1.6.0
func (s *Store) GetBalancesAggregated(ctx context.Context, q ledger.AggregatedBalancesQuery) (core.AssetsBalances, error)
func (*Store) GetLastLog ¶ added in v1.9.0
func (*Store) GetLastTransaction ¶ added in v1.3.2
func (*Store) GetMigrationsAvailable ¶ added in v1.9.0
func (s *Store) GetMigrationsAvailable() ([]core.MigrationInfo, error)
func (*Store) GetMigrationsDone ¶ added in v1.9.0
func (*Store) GetTransaction ¶
func (*Store) GetTransactions ¶ added in v1.3.2
func (s *Store) GetTransactions(ctx context.Context, q ledger.TransactionsQuery) (api.Cursor[core.ExpandedTransaction], error)
func (*Store) SaveMapping ¶
func (*Store) UpdateAccountMetadata ¶ added in v1.8.0
type SystemStore ¶ added in v1.8.0
type SystemStore struct {
// contains filtered or unexported fields
}
func (SystemStore) DeleteLedger ¶ added in v1.8.0
func (s SystemStore) DeleteLedger(ctx context.Context, name string) error
func (*SystemStore) GetConfiguration ¶ added in v1.8.0
func (SystemStore) InsertConfiguration ¶ added in v1.8.0
func (s SystemStore) InsertConfiguration(ctx context.Context, key, value string) error
func (SystemStore) ListLedgers ¶ added in v1.8.0
func (s SystemStore) ListLedgers(ctx context.Context) ([]string, error)
type TxsPaginationToken ¶ added in v1.3.2
type TxsPaginationToken struct { AfterTxID uint64 `json:"after"` ReferenceFilter string `json:"reference,omitempty"` AccountFilter string `json:"account,omitempty"` SourceFilter string `json:"source,omitempty"` DestinationFilter string `json:"destination,omitempty"` StartTime time.Time `json:"startTime,omitempty"` EndTime time.Time `json:"endTime,omitempty"` MetadataFilter map[string]string `json:"metadata,omitempty"` PageSize uint `json:"pageSize,omitempty"` }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.