core

package
v0.0.0-...-3eec7cb Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyRelation = func(q *bun.Query) (*bun.Query, error) {
	return q, nil
}

EmptyRelation -

Functions

func Address

func Address(query *bun.SelectQuery, address string) *bun.SelectQuery

Address -

func Contract

func Contract(query *bun.SelectQuery, address string) *bun.SelectQuery

Contract -

func GetFieldsForModel

func GetFieldsForModel(data interface{}, fields ...string) map[string]interface{}

GetFieldsForModel -

func IsApplied

func IsApplied(db *bun.SelectQuery) *bun.SelectQuery

IsApplied -

func OrderByLevelDesc

func OrderByLevelDesc(db *bun.SelectQuery) *bun.SelectQuery

OrderByLevelDesc -

func Token

func Token(query *bun.SelectQuery, contract string, tokenID uint64) *bun.SelectQuery

Token -

Types

type Config

type Config struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	User     string `yaml:"user"`
	DBName   string `yaml:"dbname"`
	Password string `yaml:"password"`
	SslMode  string `yaml:"sslmode"`
}

func (Config) ConnectionString

func (cfg Config) ConnectionString() string

ConnectionString -

type Postgres

type Postgres struct {
	DB *bun.DB

	PageSize int64
	// contains filtered or unexported fields
}

Postgres -

func New

func New(cfg Config, schemaName, appName string, opts ...PostgresOption) (*Postgres, error)

New -

func WaitNew

func WaitNew(cfg Config, schemaName, appName string, timeout int, opts ...PostgresOption) *Postgres

WaitNew - waiting for db up and creating connection

func (*Postgres) Close

func (p *Postgres) Close() error

Close -

func (*Postgres) CreateIndex

func (p *Postgres) CreateIndex(ctx context.Context, name, columns string, model any) error

func (*Postgres) Drop

func (p *Postgres) Drop(ctx context.Context) error

Drop - drops full database

func (*Postgres) Execute

func (p *Postgres) Execute(rawSQL string) error

Execute -

func (*Postgres) GetByID

func (p *Postgres) GetByID(ctx context.Context, output models.Model) error

GetByID -

func (*Postgres) GetPageSize

func (pg *Postgres) GetPageSize(size int64) int

GetPageSize - validate and return page size

func (*Postgres) InitDatabase

func (p *Postgres) InitDatabase(ctx context.Context) error

func (*Postgres) IsRecordNotFound

func (p *Postgres) IsRecordNotFound(err error) bool

IsRecordNotFound -

func (*Postgres) TablesExist

func (p *Postgres) TablesExist(ctx context.Context) bool

TablesExist - returns true if all tables exist otherwise false

type PostgresOption

type PostgresOption func(pg *Postgres)

PostgresOption -

func WithPageSize

func WithPageSize(pageSize int64) PostgresOption

WithPageSize -

func WithQueryLogging

func WithQueryLogging() PostgresOption

WithQueryLogging -

type TimestampFilter

type TimestampFilter struct {
	Gt  time.Time
	Gte time.Time
	Lt  time.Time
	Lte time.Time
}

TimestampFilter -

func (TimestampFilter) Apply

Apply -

type Transaction

type Transaction struct {
	// contains filtered or unexported fields
}

func NewTransaction

func NewTransaction(ctx context.Context, db *bun.DB) (Transaction, error)

NewTransaction -

func (Transaction) Accounts

func (t Transaction) Accounts(ctx context.Context, accounts ...*account.Account) error

func (Transaction) BabylonUpdateBigMapDiffs

func (t Transaction) BabylonUpdateBigMapDiffs(ctx context.Context, contract string, ptr int64) (int, error)

func (Transaction) BabylonUpdateNonDelegator

func (t Transaction) BabylonUpdateNonDelegator(ctx context.Context, contract *contract.Contract) error

func (Transaction) BigMapActions

func (t Transaction) BigMapActions(ctx context.Context, bigmapactions ...*bigmapaction.BigMapAction) error

func (Transaction) BigMapDiffs

func (t Transaction) BigMapDiffs(ctx context.Context, bigmapdiffs ...*bigmapdiff.BigMapDiff) error

func (Transaction) BigMapStates

func (t Transaction) BigMapStates(ctx context.Context, states ...*bigmapdiff.BigMapState) error

func (Transaction) Block

func (t Transaction) Block(ctx context.Context, block *block.Block) error

func (Transaction) Commit

func (t Transaction) Commit() error

func (Transaction) Contracts

func (t Transaction) Contracts(ctx context.Context, contracts ...*contract.Contract) error

func (Transaction) DeleteBigMapStatesByContract

func (t Transaction) DeleteBigMapStatesByContract(ctx context.Context, contract string) (states []bigmapdiff.BigMapState, err error)

func (Transaction) GlobalConstants

func (t Transaction) GlobalConstants(ctx context.Context, constants ...*contract.GlobalConstant) error

func (Transaction) JakartaUpdateNonDelegator

func (t Transaction) JakartaUpdateNonDelegator(ctx context.Context, contract *contract.Contract) error

func (Transaction) JakartaVesting

func (t Transaction) JakartaVesting(ctx context.Context, contract *contract.Contract) error

func (Transaction) Migrations

func (t Transaction) Migrations(ctx context.Context, migrations ...*migration.Migration) error

func (Transaction) Operations

func (t Transaction) Operations(ctx context.Context, operations ...*operation.Operation) error

func (Transaction) Protocol

func (t Transaction) Protocol(ctx context.Context, proto *protocol.Protocol) error

func (Transaction) Rollback

func (t Transaction) Rollback() error

func (Transaction) Save

func (t Transaction) Save(ctx context.Context, data any) error

func (Transaction) ScriptConstant

func (t Transaction) ScriptConstant(ctx context.Context, relations ...*contract.ScriptConstants) error

func (Transaction) Scripts

func (t Transaction) Scripts(ctx context.Context, scripts ...*contract.Script) error

func (Transaction) SmartRollups

func (t Transaction) SmartRollups(ctx context.Context, rollups ...*smartrollup.SmartRollup) error

func (Transaction) TickerUpdates

func (t Transaction) TickerUpdates(ctx context.Context, updates ...*ticket.TicketUpdate) error

func (Transaction) TicketBalances

func (t Transaction) TicketBalances(ctx context.Context, balances ...*ticket.Balance) error

func (Transaction) Tickets

func (t Transaction) Tickets(ctx context.Context, tickets ...*ticket.Ticket) error

func (Transaction) ToBabylon

func (t Transaction) ToBabylon(ctx context.Context) error

func (Transaction) ToJakarta

func (t Transaction) ToJakarta(ctx context.Context) error

func (Transaction) UpdateStats

func (t Transaction) UpdateStats(ctx context.Context, stats stats.Stats) error

Jump to

Keyboard shortcuts

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