tables

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidCInsDesc = errors.New("invalid CIns description data")
View Source
var Tables = []interface{}{
	&InscribeOrder{},
	&BlockParserInfo{},
	&UndoLog{},
	&SavePoint{},
}

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 BlockParserInfo

type BlockParserInfo struct {
	Id        uint64    `json:"id" gorm:"column:id;primaryKey;type:bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT ''"`
	Height    uint32    `` /* 132-byte string literal not displayed */
	BlockHash string    `` /* 140-byte string literal not displayed */
	CreatedAt time.Time `json:"created_at" gorm:"column:created_at;type:timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ''"`
	UpdatedAt time.Time `` /* 131-byte string literal not displayed */
}

func (*BlockParserInfo) TableName

func (t *BlockParserInfo) 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 InscribeOrder

type InscribeOrder struct {
	Id             uint64 `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"`
	OrderId        string `gorm:"column:order_id;type:varchar(255);index:idx_order_id;default:'';NOT NULL"`
	InscriptionId  `gorm:"embedded"`
	RevealAddress  string      `gorm:"column:reveal_address;type:varchar(255);index:idx_reveal_address;default:;NOT NULL"`
	RevealPriKey   string      `gorm:"column:reveal_pri_key;type:varchar(255);default:;NOT NULL"`
	RevealTxId     string      `gorm:"column:reveal_tx_id;type:varchar(255);index:idx_reveal_tx_id;default:;NOT NULL"`
	RevealTxRaw    string      `gorm:"column:reveal_tx_raw;type:mediumtext;default:;NOT NULL"`
	RevealTxValue  int64       `gorm:"column:reveal_tx_value;type:bigint;default:0;NOT NULL"`
	ReceiveAddress string      `gorm:"column:receive_address;type:varchar(255);index:idx_receive_address;default:;NOT NULL"`
	CommitTxId     string      `gorm:"column:commit_tx_id;type:varchar(255);index:idx_commit_tx_id;default:;NOT NULL"`
	Status         OrderStatus `gorm:"column:status;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 (*InscribeOrder) InitOrderId

func (o *InscribeOrder) InitOrderId()

func (*InscribeOrder) TableName

func (o *InscribeOrder) TableName() string

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 OrderStatus

type OrderStatus int
const (
	OrderStatusFeeNotEnough OrderStatus = -2
	OrderStatusFail         OrderStatus = -1
	OrderStatusDefault      OrderStatus = 0
	OrderStatusRevealSend   OrderStatus = 1
	OrderStatusSuccess      OrderStatus = 2
)

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 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 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 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