indexer

package
v0.0.0-...-e5308b5 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*gorm.DB
	// contains filtered or unexported fields
}

DB is a struct that embeds gorm.DB to provide additional database functionality.

func NewDB

func NewDB(opts ...DBOption) (*DB, error)

NewDB is a function that creates a new DB instance with the provided options.

func (*DB) BlockHeight

func (d *DB) BlockHeight() (height uint32, err error)

BlockHeight retrieves the height of the last block in the database.

func (*DB) FindInscriptionsByPage

func (d *DB) FindInscriptionsByPage(page, size int) (list []*tables.InscriptionId, err error)

FindInscriptionsByPage retrieves a page of inscription IDs. It returns a list of inscription IDs and any error encountered.

func (*DB) FindInscriptionsInBlock

func (d *DB) FindInscriptionsInBlock(height uint32) (list []*model.OutPoint, err error)

func (*DB) FindInscriptionsInBlockPage

func (d *DB) FindInscriptionsInBlockPage(height, page, size int) (list []*model.OutPoint, err error)

FindInscriptionsInBlockPage retrieves a page of inscription IDs in a block. It returns a list of inscription IDs and any error encountered.

func (*DB) FirstInscriptionByOwner

func (d *DB) FirstInscriptionByOwner(owner string) (firts tables.Inscriptions, err error)

func (*DB) GetInscriptionById

func (d *DB) GetInscriptionById(inscriptionId *tables.InscriptionId) (ins tables.Inscriptions, err error)

GetInscriptionById retrieves an inscription by its outpoint. It returns the inscription and any error encountered.

func (*DB) GetInscriptionByInscriptionNum

func (d *DB) GetInscriptionByInscriptionNum(inscriptionNum int64) (ins tables.Inscriptions, err error)

GetInscriptionByInscriptionNum retrieves an inscription by its sequence number. It returns the inscription and any error encountered.

func (*DB) GetInscriptionByOutpoint

func (d *DB) GetInscriptionByOutpoint(outpoint *model.OutPoint) (list []*tables.InscriptionId, err error)

GetInscriptionByOutpoint retrieves an inscription by its outpoint.

func (*DB) GetInscriptionBySequenceNum

func (d *DB) GetInscriptionBySequenceNum(sequenceNum int64) (ins tables.Inscriptions, err error)

GetInscriptionBySequenceNum retrieves an inscription by its sequence number. It returns the inscription and any error encountered.

func (*DB) InscriptionsNum

func (d *DB) InscriptionsNum() (total int64, err error)

func (*DB) InscriptionsStoredData

func (d *DB) InscriptionsStoredData() (total uint64, err error)

func (*DB) InscriptionsTotalFees

func (d *DB) InscriptionsTotalFees() (total uint64, err error)

func (*DB) NextSequenceNumber

func (d *DB) NextSequenceNumber() (num int64, err error)

NextSequenceNumber retrieves the next sequence number for inscriptions. It returns the next sequence number as an uint64 and any error encountered.

func (*DB) SearchInscriptions

func (d *DB) SearchInscriptions(params *FindProtocolsParams) (list []*tables.Inscriptions, total int64, err error)

func (*DB) Transaction

func (d *DB) Transaction(fn func(tx *DB) error) error

Transaction is a method on DB that executes a function within a database transaction.

type DBOption

type DBOption func(*DBOptions)

DBOption is a function type that modifies DBOptions.

func WithAddr

func WithAddr(addr string) DBOption

WithAddr returns a DBOption that sets the address of the database.

func WithAutoMigrateTables

func WithAutoMigrateTables(tables ...interface{}) DBOption

WithAutoMigrateTables returns a DBOption that sets the tables to be auto migrated in the database.

func WithDBName

func WithDBName(dbName string) DBOption

WithDBName returns a DBOption that sets the name of the database.

func WithPassword

func WithPassword(password string) DBOption

WithPassword returns a DBOption that sets the password of the database.

func WithUser

func WithUser(user string) DBOption

WithUser returns a DBOption that sets the user of the database.

type DBOptions

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

DBOptions is a struct that holds the configuration options for the database.

type FindProtocolsParams

type FindProtocolsParams struct {
	Page            int
	Limit           int
	Owner           string
	Ticker          string
	Order           string
	MediaTypes      []string
	ContentTypes    []string
	Charms          []string
	InscriptionType string
}

type GormLogger

type GormLogger struct {
	btclog.Logger
}

GormLogger is a struct that embeds btclog.Logger to provide additional logging functionality.

func (*GormLogger) Error

func (g *GormLogger) Error(ctx context.Context, msg string, data ...interface{})

Error is a method on GormLogger that logs an error message.

func (*GormLogger) Info

func (g *GormLogger) Info(ctx context.Context, msg string, data ...interface{})

Info is a method on GormLogger that logs an informational message.

func (*GormLogger) LogMode

func (g *GormLogger) LogMode(level logger.LogLevel) logger.Interface

LogMode is a method on GormLogger that sets the log level.

func (*GormLogger) Print

func (g *GormLogger) Print(data ...interface{})

func (*GormLogger) Trace

func (g *GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)

Trace is a method on GormLogger that logs a trace message.

func (*GormLogger) Warn

func (g *GormLogger) Warn(ctx context.Context, msg string, data ...interface{})

Warn is a method on GormLogger that logs a warning message.

type Inscription

type Inscription struct {
	*tables.Inscriptions
	*tables.SatPointToSequenceNum
}

Inscription is a struct that embeds tables.Inscriptions and util.SatPoint.

Jump to

Keyboard shortcuts

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