data

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package data contains generated code for schema 'public'.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeAccountID

func DecodeAccountID(raw AccountID) (string, []byte, error)

func DecodePublicKey

func DecodePublicKey(raw PublicKey) (string, []byte, error)

func DecodeSorting

func DecodeSorting(rawSort *string, columns map[string]string) (string, bool, error)

DecodeSorting - transforms sorting attribute specified by user into sorting column

func GetOrDefaultStr

func GetOrDefaultStr(str string, def string) string

func GetOrDefaultStrPtr

func GetOrDefaultStrPtr(str *string, def *string) *string

func GetOrDefaultUint64Ptr

func GetOrDefaultUint64Ptr(value *uint64, def *uint64) *uint64

func MustDBHash

func MustDBHash(in string) []byte

func NotNilStrPtr

func NotNilStrPtr(str *string) bool

Types

type AccountID

type AccountID string // {networkName}:{accountAddress}

func FormatAccountID

func FormatAccountID(network string, accountID []byte) AccountID

func (AccountID) String

func (id AccountID) String() string

type Approval

type Approval struct {
	ID                int64     `db:"id" json:"id" structs:"-"`                                                  // id
	TransferIndex     []byte    `db:"transfer_index" json:"transfer_index" structs:"transfer_index"`             // transfer_index
	RarimoTransaction []byte    `db:"rarimo_transaction" json:"rarimo_transaction" structs:"rarimo_transaction"` // rarimo_transaction
	CreatedAt         time.Time `db:"created_at" json:"created_at" structs:"created_at"`                         // created_at

}

type ApprovalQ

type ApprovalQ interface {
	InsertBatchCtx(ctx context.Context, approvals ...Approval) error
	ApprovalsByTransferIndexCtx(ctx context.Context, transferIndex []byte, isForUpdate bool) ([]Approval, error)
}

type Chain

type Chain struct {
	ID          int                      `fig:"id,required"`
	Name        string                   `fig:"name,required"`
	Rpc         string                   `fig:"rpc,required"`
	Type        tokenmanager.NetworkType `fig:"type,required"`
	Icon        *string                  `fig:"icon"`
	ChainParams json.RawMessage          `fig:"chain_params"`
}

type ChainsQ

type ChainsQ interface {
	Get(chain string) *Chain
	List() []Chain
	Page(pageNum, limit int) []Chain
}

type Collection

type Collection struct {
	ID        int64     `db:"id" json:"id" structs:"-"`                          // id
	Index     []byte    `db:"index" json:"index" structs:"index"`                // index
	Metadata  xo.Jsonb  `db:"metadata" json:"metadata" structs:"metadata"`       // metadata
	CreatedAt time.Time `db:"created_at" json:"created_at" structs:"created_at"` // created_at
	UpdatedAt time.Time `db:"updated_at" json:"updated_at" structs:"updated_at"` // updated_at

}

Collection represents a row from 'public.collections'.

type CollectionChainMapping

type CollectionChainMapping struct {
	Collection int64         `db:"collection" json:"collection" structs:"-"`          // collection
	Network    int           `db:"network" json:"network" structs:"-"`                // network
	Address    []byte        `db:"address" json:"address" structs:"address"`          // address
	TokenType  sql.NullInt64 `db:"token_type" json:"token_type" structs:"token_type"` // token_type
	Wrapped    sql.NullBool  `db:"wrapped" json:"wrapped" structs:"wrapped"`          // wrapped
	Decimals   sql.NullInt64 `db:"decimals" json:"decimals" structs:"decimals"`       // decimals
	CreatedAt  time.Time     `db:"created_at" json:"created_at" structs:"created_at"` // created_at
	UpdatedAt  time.Time     `db:"updated_at" json:"updated_at" structs:"updated_at"` // updated_at

}

CollectionChainMapping represents a row from 'public.collection_chain_mappings'.

type CollectionChainMappingQ

type CollectionChainMappingQ interface {
	InsertBatchCtx(ctx context.Context, chainMappings ...CollectionChainMapping) error
	InsertCtx(ctx context.Context, ccm *CollectionChainMapping) error

	CollectionChainMappingByCollectionNetworkCtx(ctx context.Context, collection int64, network int, isForUpdate bool) (*CollectionChainMapping, error)

	UpsertCtx(ctx context.Context, ccm *CollectionChainMapping) error

	DeleteByCollectionCtx(ctx context.Context, collection int64) error
	DeleteCtx(ctx context.Context, ccm *CollectionChainMapping) error
}

type CollectionQ

type CollectionQ interface {
	InsertCtx(ctx context.Context, c *Collection) error
	CollectionByIndexCtx(ctx context.Context, index []byte, isForUpdate bool) (*Collection, error)
	DeleteCtx(ctx context.Context, c *Collection) error
}

type Confirmation

type Confirmation struct {
	ID                int64     `db:"id" json:"id" structs:"-"`                                                  // id
	TransferIndex     []byte    `db:"transfer_index" json:"transfer_index" structs:"transfer_index"`             // transfer_index
	RarimoTransaction []byte    `db:"rarimo_transaction" json:"rarimo_transaction" structs:"rarimo_transaction"` // rarimo_transaction
	CreatedAt         time.Time `db:"created_at" json:"created_at" structs:"created_at"`                         // created_at

}

Confirmation represents a row from 'public.confirmations'.

type ConfirmationQ

type ConfirmationQ interface {
	InsertBatchCtx(ctx context.Context, confirmations ...Confirmation) error
	ConfirmationsByTransferIndexCtx(ctx context.Context, transferIndex []byte, isForUpdate bool) ([]Confirmation, error)
}

type Cursor

type Cursor struct {
	PageNumber uint64
	ItemIndex  uint64
}

func DecodeCursor

func DecodeCursor(cursor string) (*Cursor, error)

func NewCursor

func NewCursor(page, itemIndex uint64) *Cursor

func (Cursor) String

func (c Cursor) String() string

type GorpMigration

type GorpMigration struct {
	ID        string       `db:"id" json:"id" structs:"-"`                          // id
	AppliedAt sql.NullTime `db:"applied_at" json:"applied_at" structs:"applied_at"` // applied_at

}

GorpMigration represents a row from 'public.gorp_migrations'.

type GorpMigrationQ

type GorpMigrationQ interface {
}

type IndexConfig

type IndexConfig struct {
	TransfersIndexSuffix string `fig:"transfers_index_suffix"`
}

type Int256

type Int256 struct {
	*big.Int
}

Int256 - represents

func (Int256) MarshalMsgpack

func (b Int256) MarshalMsgpack() ([]byte, error)

func (*Int256) Scan

func (b *Int256) Scan(value interface{}) error

Scan implements the Scanner interface for Uint256

func (*Int256) UnmarshalMsgpack

func (b *Int256) UnmarshalMsgpack(value []byte) error

func (Int256) Value

func (b Int256) Value() (driver.Value, error)

Value implements the Valuer interface for Uint256

type Item

type Item struct {
	ID         int64         `db:"id" json:"id" structs:"-"`                          // id
	Index      []byte        `db:"index" json:"index" structs:"index"`                // index
	Collection sql.NullInt64 `db:"collection" json:"collection" structs:"collection"` // collection
	Metadata   xo.Jsonb      `db:"metadata" json:"metadata" structs:"metadata"`       // metadata
	CreatedAt  time.Time     `db:"created_at" json:"created_at" structs:"created_at"` // created_at
	UpdatedAt  time.Time     `db:"updated_at" json:"updated_at" structs:"updated_at"` // updated_at

}

Item represents a row from 'public.items'.

type ItemChainMapping

type ItemChainMapping struct {
	Item      int64     `db:"item" json:"item" structs:"-"`                      // item
	Network   int       `db:"network" json:"network" structs:"-"`                // network
	Address   []byte    `db:"address" json:"address" structs:"address"`          // address
	TokenID   []byte    `db:"token_id" json:"token_id" structs:"token_id"`       // token_id
	CreatedAt time.Time `db:"created_at" json:"created_at" structs:"created_at"` // created_at
	UpdatedAt time.Time `db:"updated_at" json:"updated_at" structs:"updated_at"` // updated_at

}

ItemChainMapping represents a row from 'public.item_chain_mappings'.

type ItemChainMappingQ

type ItemChainMappingQ interface {
	InsertBatchCtx(ctx context.Context, chainMappings ...ItemChainMapping) error
	InsertCtx(ctx context.Context, icm *ItemChainMapping) error

	ItemChainMappingByItemNetworkCtx(ctx context.Context, item int64, network int, isForUpdate bool) (*ItemChainMapping, error)
	ItemChainMappingsByNetworkCtx(ctx context.Context, network int, isForUpdate bool) ([]ItemChainMapping, error)

	DeleteByItemCtx(ctx context.Context, item int64) error
	DeleteCtx(ctx context.Context, icm *ItemChainMapping) error
}

type ItemQ

type ItemQ interface {
	InsertCtx(ctx context.Context, i *Item) error
	ItemByIndexCtx(ctx context.Context, index []byte, isForUpdate bool) (*Item, error)
	ItemByIDCtx(ctx context.Context, id int64, isForUpdate bool) (*Item, error)
	UpdateCtx(ctx context.Context, i *Item) error
	DeleteCtx(ctx context.Context, i *Item) error
}

type ItemsSelector

type ItemsSelector struct {
	Network    *string `json:"network,omitempty"`
	Collection *int64  `json:"collection,omitempty"`
}

type KeyValue

type KeyValue struct {
	Key       string    `json:"key"`
	Value     string    `json:"value"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type KeyValueQ

type KeyValueQ interface {
	Upsert(ctx context.Context, kv KeyValue) error
	Get(ctx context.Context, key string) (*KeyValue, error)
	Remove(ctx context.Context, key string) error
}

type Nft

type Nft struct {
	ID             string         `json:"id"`
	Name           string         `json:"name"`
	Description    *string        `json:"description"`
	ImageURL       string         `json:"image_url"`
	CollectionName string         `json:"collection_name,omitempty"`
	Attributes     []NftAttribute `json:"attributes,omitempty"`
}

DEPRECATED TODO use aggregated Items instead of Nft and make new endpoints

type NftAttribute

type NftAttribute struct {
	Trait string `json:"trait_type"`
	Value string `json:"value"`
}

type NftMetadata

type NftMetadata struct {
	Name         string         `json:"name"`
	ImageURL     string         `json:"image_url"`
	MetadataUrl  *string        `json:"metadata_url,omitempty"`
	Description  *string        `json:"description,omitempty"`
	AnimationUrl *string        `json:"animation_url,omitempty"`
	ExternalUrl  *string        `json:"external_url,omitempty"`
	Attributes   []NftAttribute `json:"attributes,omitempty"`
}

func (*NftMetadata) Merge

func (m *NftMetadata) Merge(metadata *NftMetadata)

type PublicKey

type PublicKey string // {networkName}:{publicKey}

func FormatPublicKey

func FormatPublicKey(network string, publicKey []byte) PublicKey

func (PublicKey) String

func (pk PublicKey) String() string

type Rejection

type Rejection struct {
	ID                int64     `db:"id" json:"id" structs:"-"`                                                  // id
	TransferIndex     []byte    `db:"transfer_index" json:"transfer_index" structs:"transfer_index"`             // transfer_index
	RarimoTransaction []byte    `db:"rarimo_transaction" json:"rarimo_transaction" structs:"rarimo_transaction"` // rarimo_transaction
	CreatedAt         time.Time `db:"created_at" json:"created_at" structs:"created_at"`                         // created_at

}

Rejection represents a row from 'public.rejections'.

type RejectionQ

type RejectionQ interface {
	InsertBatchCtx(ctx context.Context, rejections ...Rejection) error
	RejectionsByTransferIndexCtx(ctx context.Context, transferIndex []byte, isForUpdate bool) ([]Rejection, error)
}

type SeedQ

type SeedQ interface {
}

type Storage

type Storage interface {
	Transaction(func() error) error
	TransferQ() TransferQ
	ConfirmationQ() ConfirmationQ
	TransactionQ() TransactionQ
	VoteQ() VoteQ
	ApprovalQ() ApprovalQ
	RejectionQ() RejectionQ

	CollectionQ() CollectionQ
	CollectionChainMappingQ() CollectionChainMappingQ
	ItemQ() ItemQ
	ItemChainMappingQ() ItemChainMappingQ
}

type StringSlice

type StringSlice []string

StringSlice is a slice of strings.

func (*StringSlice) Scan

func (ss *StringSlice) Scan(src interface{}) error

Scan satisfies the sql.Scanner interface for StringSlice.

func (StringSlice) Value

func (ss StringSlice) Value() (driver.Value, error)

Value satisfies the driver.Valuer interface for StringSlice.

type Token

type Token struct {
	ID     string  `fig:"id,required"`
	Name   string  `fig:"name,required"`
	Symbol string  `fig:"symbol,required"`
	Icon   *string `fig:"icon"`
	// Relation
	Chains []TokenChain `fig:"chains,required"`
}

type TokenChain

type TokenChain struct {
	TokenID         string            `fig:"token_id,required"`
	TokenType       tokenmanager.Type `fig:"token_type,required"`
	ChainID         string            `fig:"chain_id,required"`
	ContractAddress string            `fig:"contract_address,required"`
	Wrapped         bool              `fig:"wrapped"`
}

type Transaction

type Transaction struct {
	Hash        []byte        `db:"hash" json:"hash" structs:"-"`                            // hash
	BlockHeight sql.NullInt64 `db:"block_height" json:"block_height" structs:"block_height"` // block_height
	Index       sql.NullInt64 `db:"index" json:"index" structs:"index"`                      // index
	RawTx       []byte        `db:"raw_tx" json:"raw_tx" structs:"raw_tx"`                   // raw_tx
	TxResult    xo.NullJsonb  `db:"tx_result" json:"tx_result" structs:"tx_result"`          // tx_result
	TxTimestamp time.Time     `db:"tx_timestamp" json:"tx_timestamp" structs:"tx_timestamp"` // tx_timestamp
	CreatedAt   time.Time     `db:"created_at" json:"created_at" structs:"created_at"`       // created_at

}

Transaction represents a row from 'public.transactions'.

type TransactionQ

type TransactionQ interface {
	InsertBatchCtx(ctx context.Context, transactions ...Transaction) error
}

type Transfer

type Transfer struct {
	ID                int64          `db:"id" json:"id" structs:"-"`                                                     // id
	Index             []byte         `db:"index" json:"index" structs:"index"`                                           // index
	Status            int            `db:"status" json:"status" structs:"status"`                                        // status
	CreatedAt         time.Time      `db:"created_at" json:"created_at" structs:"created_at"`                            // created_at
	UpdatedAt         time.Time      `db:"updated_at" json:"updated_at" structs:"updated_at"`                            // updated_at
	Creator           sql.NullString `db:"creator" json:"creator" structs:"creator"`                                     // creator
	RarimoTx          []byte         `db:"rarimo_tx" json:"rarimo_tx" structs:"rarimo_tx"`                               // rarimo_tx
	RarimoTxTimestamp time.Time      `db:"rarimo_tx_timestamp" json:"rarimo_tx_timestamp" structs:"rarimo_tx_timestamp"` // rarimo_tx_timestamp
	Origin            string         `db:"origin" json:"origin" structs:"origin"`                                        // origin
	Tx                []byte         `db:"tx" json:"tx" structs:"tx"`                                                    // tx
	EventID           int64          `db:"event_id" json:"event_id" structs:"event_id"`                                  // event_id
	FromChain         string         `db:"from_chain" json:"from_chain" structs:"from_chain"`                            // from_chain
	ToChain           string         `db:"to_chain" json:"to_chain" structs:"to_chain"`                                  // to_chain
	Receiver          string         `db:"receiver" json:"receiver" structs:"receiver"`                                  // receiver
	Amount            Int256         `db:"amount" json:"amount" structs:"amount"`                                        // amount
	BundleData        []byte         `db:"bundle_data" json:"bundle_data" structs:"bundle_data"`                         // bundle_data
	BundleSalt        []byte         `db:"bundle_salt" json:"bundle_salt" structs:"bundle_salt"`                         // bundle_salt
	TokenIndex        string         `db:"token_index" json:"token_index" structs:"token_index"`                         // token_index

}

Transfer represents a row from 'public.transfers'.

func (Transfer) RarimoTxHash

func (s Transfer) RarimoTxHash() string

type TransferQ

type TransferQ interface {
	SelectCtx(ctx context.Context, selector TransferSelector) ([]Transfer, error)
	UpsertBatchCtx(ctx context.Context, transfers ...Transfer) error
	TransferByIndexCtx(ctx context.Context, index []byte, isForUpdate bool) (*Transfer, error)
	SetStatusByIndexCtx(ctx context.Context, status int, indexes ...string) error
}

type TransferSelector

type TransferSelector struct {
	Origin           *string    `json:"origin,omitempty"`
	RarimoTx         *string    `json:"bridge_tx,omitempty"`
	ChainTx          *string    `json:"original_tx,omitempty"`
	SourceChain      *string    `json:"src_chain,omitempty"`
	DestinationChain *string    `json:"dst_chain,omitempty"`
	Receiver         *string    `json:"receiver,omitempty"`
	Status           *int       `json:"signed,omitempty"`
	Creator          *string    `json:"creator,omitempty"`
	Before           *time.Time `json:"bridged_before,omitempty"`
	After            *time.Time `json:"bridged_after,omitempty"`
	TokenIndex       *string    `json:"token_index,omitempty"`

	PageCursor uint64     `json:"page_number,omitempty"`
	PageSize   uint64     `json:"page_size,omitempty"`
	Sort       pgdb.Sorts `json:"sort"`
}

func (TransferSelector) MustCacheKey

func (s TransferSelector) MustCacheKey() string

type Vote

type Vote struct {
	ID                int64     `db:"id" json:"id" structs:"-"`                                                  // id
	TransferIndex     []byte    `db:"transfer_index" json:"transfer_index" structs:"transfer_index"`             // transfer_index
	Choice            int       `db:"choice" json:"choice" structs:"choice"`                                     // choice
	RarimoTransaction []byte    `db:"rarimo_transaction" json:"rarimo_transaction" structs:"rarimo_transaction"` // rarimo_transaction
	CreatedAt         time.Time `db:"created_at" json:"created_at" structs:"created_at"`                         // created_at

}

Vote represents a row from 'public.votes'.

type VoteQ

type VoteQ interface {
	InsertBatchCtx(ctx context.Context, votes ...Vote) error
	VotesByTransferIndexCtx(ctx context.Context, transferIndex []byte, isForUpdate bool) ([]Vote, error)
}

Directories

Path Synopsis
Package pg contains generated code for schema 'public'.
Package pg contains generated code for schema 'public'.

Jump to

Keyboard shortcuts

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