tables

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 12 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidCInsDesc = errors.New("invalid CIns description data")
View Source
var ErrInvalidSatRange = errors.New("invalid sat range")

Functions

func FormatOutpoint

func FormatOutpoint(txid string, index uint32) string

func FormatSatPoint

func FormatSatPoint(outpoint string, sat uint64) string

Types

type BlockInfo

type BlockInfo struct {
	Id          uint64    `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"`
	Height      uint32    `gorm:"column:height;type:int unsigned;index:idx_height;default:0;NOT NULL"`
	SequenceNum int64     `gorm:"column:sequence_num;type:bigint;index:idx_sequence_num;default:0;NOT NULL"`
	Header      []byte    `gorm:"column:header;type:blob;NOT NULL;comment:header"`
	Timestamp   int64     `gorm:"column:timestamp;type:bigint;default:0;NOT NULL;comment:timestamp"`
	CreatedAt   time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
	UpdatedAt   time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
}

func (*BlockInfo) LoadHeader

func (b *BlockInfo) LoadHeader() (*wire.BlockHeader, error)

func (*BlockInfo) TableName

func (b *BlockInfo) TableName() string

type CInsDescription

type CInsDescription struct {
	Type     string `gorm:"column:type;type:varchar(255);default:'';NOT NULL" json:"type"` // blockchain/ordinals
	Chain    string `gorm:"column:chain;type:varchar(255);index:idx_chain;default:'';NOT NULL" json:"chain"`
	Contract string `gorm:"column:contract;type:varchar(255);index:idx_contract;default:'';NOT NULL" json:"contract"`
}

func CInsDescriptionFromBytes

func CInsDescriptionFromBytes(data []byte) (*CInsDescription, error)

func CInsDescriptionFromFile

func CInsDescriptionFromFile(file string) (*CInsDescription, error)

func (*CInsDescription) Data

func (u *CInsDescription) Data() []byte

type InscriptionId

type InscriptionId struct {
	TxId   string `gorm:"column:tx_id;type:varchar(255);index:idx_tx_id;default:'';NOT NULL" json:"txid"` // tx id
	Offset uint32 `gorm:"column:offset;type:int unsigned;default:0;NOT NULL" json:"offset"`               // inscription offset of tx
}

func NewInscriptionId

func NewInscriptionId(txid string, offset uint32) *InscriptionId

func StringToInscriptionId

func StringToInscriptionId(s string) *InscriptionId

func (*InscriptionId) MarshalJSON

func (i *InscriptionId) MarshalJSON() ([]byte, error)

func (*InscriptionId) String

func (i *InscriptionId) String() string

type Inscriptions

type Inscriptions struct {
	Id              uint64 `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"` // this is sequence_num
	InscriptionId   `gorm:"embedded"`
	Index           uint32          `gorm:"column:index;type:int unsigned;default:0;NOT NULL"` // outpoint index of tx
	SequenceNum     int64           `gorm:"column:sequence_num;type:bigint;index:idx_sequence_num;default:0;NOT NULL"`
	InscriptionNum  int64           `gorm:"column:inscription_num;type:bigint;index:idx_inscription_num;default:0;NOT NULL"`
	Owner           string          `gorm:"column:owner;type:varchar(255);index:idx_owner;default:'';NOT NULL"`
	Charms          uint16          `gorm:"column:charms;type:tinyint unsigned;default:0;NOT NULL"`
	Fee             uint64          `gorm:"column:fee;type:bigint unsigned;default:0;NOT NULL"`
	Height          uint32          `gorm:"column:height;type:int unsigned;default:0;NOT NULL"`
	Sat             uint64          `gorm:"column:sat;type:bigint unsigned;index:idx_sat;default:0;NOT NULL"`
	Timestamp       int64           `gorm:"column:timestamp;type:bigint unsigned;default:0;NOT NULL"`
	Body            []byte          `gorm:"column:body;type:mediumblob"`
	ContentEncoding string          `gorm:"column:content_encoding;type:varchar(255);default:'';NOT NULL"`
	ContentType     string          `gorm:"column:content_type;type:varchar(255);default:'';NOT NULL"`
	MediaType       string          `gorm:"column:media_type;type:varchar(255);index:idx_media_type;default:'';NOT NULL"`
	ContentSize     uint32          `gorm:"column:content_size;type:int unsigned;default:0;NOT NULL"`
	ContentProtocol string          `gorm:"column:content_protocol;type:varchar(255);default:'';NOT NULL"`
	CInsDescription CInsDescription `gorm:"embedded"`
	Metadata        []byte          `gorm:"column:metadata;type:mediumblob"`
	Pointer         int32           `gorm:"column:pointer;type:int;default:0;NOT NULL"`
	CreatedAt       time.Time       `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
	UpdatedAt       time.Time       `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
}

func (*Inscriptions) TableName

func (i *Inscriptions) TableName() string

type Outpoint

type Outpoint struct {
	TxId  string `gorm:"column:tx_id;type:varchar(255);index:idx_tx_id;default:'';NOT NULL" json:"txid"` // tx id
	Index uint32 `gorm:"column:index;type:int unsigned;default:0;NOT NULL"`                              // outpoint index of tx
}

func (*Outpoint) String

func (o *Outpoint) String() string

type OutpointSatRange

type OutpointSatRange struct {
	Id        uint64    `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"`
	Outpoint  string    `gorm:"column:outpoint;type:varchar(255);index:idx_outpoint;default:;NOT NULL"`
	SatRange  []byte    `gorm:"column:sat_range;type:longblob;default:;NOT NULL"`
	CreatedAt time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
	UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
}

func (*OutpointSatRange) TableName

func (o *OutpointSatRange) TableName() string

type OutpointValue

type OutpointValue struct {
	Id        uint64    `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"`
	Outpoint  string    `gorm:"column:outpoint;type:varchar(255);index:idx_outpoint;default:;NOT NULL"`
	Value     int64     `gorm:"column:value;type:bigint unsigned;default:0;NOT NULL;comment:value on outpoint"`
	CreatedAt time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
	UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
}

func (*OutpointValue) TableName

func (o *OutpointValue) TableName() string

type Protocol

type Protocol struct {
	Id            uint64 `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"` // this is sequence_num
	InscriptionId `gorm:"embedded"`
	Index         uint32    `gorm:"column:index;type:int unsigned;default:0;NOT NULL"` // outpoint index of tx
	SequenceNum   int64     `gorm:"column:sequence_num;type:bigint;index:idx_sequence_num;default:0;NOT NULL"`
	Protocol      string    `gorm:"column:protocol;type:varchar(255);index:idx_protocol;default:;NOT NULL"`
	Ticker        string    `gorm:"column:ticker;type:varchar(255);index:idx_ticker;default:;NOT NULL"`
	Operator      string    `gorm:"column:operator;type:varchar(255);index:idx_operator;default:;NOT NULL"`
	Owner         string    `gorm:"column:owner;type:varchar(255);index:idx_owner;default:;NOT NULL"`
	Max           uint64    `gorm:"column:max;type:bigint unsigned;default:0;NOT NULL"`
	Limit         uint64    `gorm:"column:limit;type:bigint unsigned;default:0;NOT NULL"`
	Decimals      uint32    `gorm:"column:decimals;type:int unsigned;default:0;NOT NULL"`
	CreatedAt     time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
	UpdatedAt     time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
}

func (*Protocol) TableName

func (t *Protocol) TableName() string

type ProtocolAmount

type ProtocolAmount struct {
	TkID   string `gorm:"column:tkid" json:"ticker_id"`
	Ticker string `gorm:"column:ticker" json:"ticker"`
	Amount uint64 `gorm:"column:amount" json:"amount"`
}

ProtocolAmount is a struct that represents the amount of a protocol.

type SatPointToSequenceNum

type SatPointToSequenceNum struct {
	Id          uint64    `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"`
	Outpoint    string    `gorm:"column:outpoint;type:varchar(255);index:idx_outpoint;default:;NOT NULL"`
	Offset      uint64    `gorm:"column:offset;type:bigint unsigned;default:0;NOT NULL"`
	SequenceNum int64     `gorm:"column:sequence_num;type:bigint;index:idx_sequence_num;default:0;NOT NULL"`
	CreatedAt   time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
	UpdatedAt   time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
}

func (*SatPointToSequenceNum) String

func (s *SatPointToSequenceNum) String() string

func (*SatPointToSequenceNum) TableName

func (s *SatPointToSequenceNum) TableName() string

type SatRange

type SatRange struct {
	Start uint64
	End   uint64
}

func NewSatRange

func NewSatRange(v []byte) (*SatRange, error)

func (*SatRange) Store

func (s *SatRange) Store() []byte

type SatRanges

type SatRanges []*SatRange

func NewSatRanges

func NewSatRanges(data []byte) (SatRanges, error)

type SatSatPoint

type SatSatPoint struct {
	Id        uint64    `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"`
	Sat       uint64    `gorm:"column:sat;type:bigint unsigned;index:idx_sat;default:0;NOT NULL;comment:sat num"`
	Outpoint  string    `gorm:"column:outpoint;type:varchar(255);index:idx_outpoint;default:;NOT NULL"`
	Offset    uint64    `gorm:"column:offset;type:bigint unsigned;default:0;NOT NULL;comment:offset in sats"`
	CreatedAt time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
	UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
}

func (*SatSatPoint) TableName

func (s *SatSatPoint) TableName() string

type SatToSequenceNum

type SatToSequenceNum struct {
	Id          uint64    `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"`
	Sat         uint64    `gorm:"column:sat;type:bigint unsigned;index:idx_sat;NOT NULL;comment:sat number"`
	SequenceNum int64     `gorm:"column:sequence_num;type:bigint;index:idx_sequence_num;default:0;NOT NULL"`
	CreatedAt   time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
	UpdatedAt   time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
}

func (*SatToSequenceNum) TableName

func (s *SatToSequenceNum) TableName() string

type SavePoint

type SavePoint struct {
	Id        uint64    `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"`
	Height    uint32    `gorm:"column:height;type:int unsigned;index:idx_height;default:0;NOT NULL"`
	UndoLogId uint64    `gorm:"column:undo_log_id;type:bigint unsigned;index:idx_undo_log_id;default:0;NOT NULL"`
	CreatedAt time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
	UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
}

func (*SavePoint) TableName

func (b *SavePoint) TableName() string

type Statistic

type Statistic struct {
	Id        uint64        `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"`
	Name      StatisticType `gorm:"column:name;type:varchar(255);default:;NOT NULL;comment:statistic name"`
	Count     uint64        `gorm:"column:count;type:bigint unsigned;default:0;NOT NULL;comment:count"`
	CreatedAt time.Time     `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
	UpdatedAt time.Time     `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
}

func (*Statistic) TableName

func (s *Statistic) TableName() string

type StatisticType

type StatisticType string
const (
	StatisticBlessedInscriptions StatisticType = "BlessedInscriptions"
	StatisticCommits             StatisticType = "Commits"
	StatisticCursedInscriptions  StatisticType = "CursedInscriptions"
	StatisticIndexRunes          StatisticType = "IndexRunes"
	StatisticIndexSats           StatisticType = "IndexSats"
	StatisticLostSats            StatisticType = "LostSats"
	StatisticOutputsTraversed    StatisticType = "OutputsTraversed"
	StatisticReservedRunes       StatisticType = "ReservedRunes"
	StatisticRunes               StatisticType = "Runes"
	StatisticSatRanges           StatisticType = "SatRanges"
	StatisticUnboundInscriptions StatisticType = "UnboundInscriptions"
	StatisticIndexTransactions   StatisticType = "IndexTransactions"
	StatisticIndexSpentSats      StatisticType = "IndexSpentSats"
)

type UndoLog

type UndoLog struct {
	Id        uint64    `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"`
	Height    uint32    `gorm:"column:height;type:int(11) unsigned;index:idx_height;default:0;NOT NULL;comment:height of the block"`
	Sql       string    `gorm:"column:sql;type:longtext;default:;NOT NULL;comment:sql statement"`
	CreatedAt time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
	UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;NOT NULL"`
}

func (*UndoLog) TableName

func (b *UndoLog) TableName() string

Jump to

Keyboard shortcuts

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