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 Migrate(ctx context.Context, schema Schema, migrations ...Migration) (bool, error)
- 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 SQLDriverName(f Flavor) string
- func UpdateSQLDriverMapping(flavor Flavor, name string)
- type AccPaginationToken
- type BalancesPaginationToken
- type DB
- type Driver
- func (d *Driver) Close(ctx context.Context) error
- func (d *Driver) DeleteStore(ctx context.Context, name string) error
- func (d *Driver) GetStore(ctx context.Context, name string, create bool) (storage.Store, bool, error)
- func (d *Driver) Initialize(ctx context.Context) (err error)
- func (d *Driver) List(ctx context.Context) ([]string, error)
- func (d *Driver) Name() string
- func (d *Driver) Register(ctx context.Context, ledger string) (bool, error)
- type Flavor
- type HandlersByEngine
- 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) AppendLog(ctx context.Context, logs ...core.Log) error
- func (s *Store) Close(ctx context.Context) error
- func (s *Store) CountAccounts(ctx context.Context, q storage.AccountsQuery) (uint64, error)
- func (s *Store) CountTransactions(ctx context.Context, q storage.TransactionsQuery) (uint64, error)
- func (s *Store) GetAccount(ctx context.Context, addr string) (*core.Account, error)
- func (s *Store) GetAccounts(ctx context.Context, q storage.AccountsQuery) (sharedapi.Cursor[core.Account], error)
- func (s *Store) GetAssetsVolumes(ctx context.Context, accountAddress string) (core.AssetsVolumes, error)
- func (s *Store) GetBalances(ctx context.Context, q storage.BalancesQuery) (sharedapi.Cursor[core.AccountsBalances], error)
- func (s *Store) GetBalancesAggregated(ctx context.Context, q storage.BalancesQuery) (core.AssetsBalances, error)
- func (s *Store) GetLastTransaction(ctx context.Context) (*core.Transaction, error)
- func (s *Store) GetTransaction(ctx context.Context, txId uint64) (*core.Transaction, error)
- func (s *Store) GetTransactions(ctx context.Context, q storage.TransactionsQuery) (sharedapi.Cursor[core.Transaction], error)
- func (s *Store) GetVolumes(ctx context.Context, accountAddress, asset string) (core.Volumes, error)
- func (s *Store) Initialize(ctx context.Context) (bool, error)
- func (s *Store) LastLog(ctx context.Context) (*core.Log, error)
- func (s *Store) LoadMapping(ctx context.Context) (*core.Mapping, error)
- func (s *Store) Logs(ctx context.Context) ([]core.Log, error)
- func (s *Store) Name() string
- func (s *Store) SaveMapping(ctx context.Context, mapping core.Mapping) error
- func (s *Store) Schema() Schema
- 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 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 SQLDriverName ¶
func UpdateSQLDriverMapping ¶
Types ¶
type AccPaginationToken ¶ added in v1.3.2
type AccPaginationToken struct { PageSize uint `json:"page_size"` 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 storage.BalanceOperator `json:"balance_operator,omitempty"` }
type BalancesPaginationToken ¶ added in v1.6.0
type Driver ¶ added in v1.3.2
type Driver struct {
// contains filtered or unexported fields
}
func (*Driver) DeleteStore ¶ added in v1.3.2
func (*Driver) Initialize ¶ added in v1.3.2
type Flavor ¶
type Flavor sqlbuilder.Flavor
func FlavorFromString ¶
func (Flavor) AttributeKeyValue ¶
type HandlersByEngine ¶ added in v1.7.0
type HandlersByEngine map[string][]MigrationFunc
type Migration ¶ added in v1.7.0
type Migration struct { Number string Name string Handlers HandlersByEngine }
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 }
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) 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 storage.BalancesQuery) (sharedapi.Cursor[core.AccountsBalances], error)
func (*Store) GetBalancesAggregated ¶ added in v1.6.0
func (s *Store) GetBalancesAggregated(ctx context.Context, q storage.BalancesQuery) (core.AssetsBalances, error)
func (*Store) GetLastTransaction ¶ added in v1.3.2
func (*Store) GetTransaction ¶
func (*Store) GetTransactions ¶ added in v1.3.2
func (s *Store) GetTransactions(ctx context.Context, q storage.TransactionsQuery) (sharedapi.Cursor[core.Transaction], error)
func (*Store) GetVolumes ¶ added in v1.6.0
func (*Store) SaveMapping ¶
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:"start_time,omitempty"` EndTime time.Time `json:"end_time,omitempty"` MetadataFilter map[string]string `json:"metadata,omitempty"` PageSize uint `json:"page_size,omitempty"` }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.