biz

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: MIT Imports: 5 Imported by: 0

README

Biz

Documentation

Index

Constants

View Source
const (
	ProtocolTypeBRC721 = "brc-721"
)

Variables

ProviderSet is biz providers.

Functions

This section is empty.

Types

type Collection

type Collection struct {
	ID             int                      `json:"id"`
	Tick           string                   `json:"tick"`
	P              string                   `json:"p"`
	Max            uint64                   `json:"max"`
	Supply         uint64                   `json:"supply,omitempty"`
	BaseURI        string                   `json:"base_uri,omitempty"`
	Name           string                   `json:"name,omitempty"`
	Description    string                   `json:"description,omitempty"`
	Image          string                   `json:"image,omitempty"`
	Attributes     []map[string]interface{} `json:"attributes,omitempty"`
	TxHash         string                   `json:"tx_hash,omitempty"`
	BlockHeight    uint64                   `json:"block_height"`
	BlockTime      time.Time                `json:"block_time"`
	Address        string                   `json:"address,omitempty"`
	InscriptionID  int64                    `json:"inscription_id"`
	InscriptionUID string                   `json:"inscription_uid"`
	Sig            sig.DeploySig            `json:"sig,omitempty"`
}

Collection is a Collection model.

type CollectionListOption

type CollectionListOption struct {
	Limit  int
	Offset int
	P      string
	Tick   string
	Order  string
}

type CollectionRepo

type CollectionRepo interface {
	Create(context.Context, *Collection) (*Collection, error)
	Update(context.Context, *Collection) (*Collection, error)
	FindByID(context.Context, int) (*Collection, error)
	FindByTick(context.Context, string, string) (*Collection, error)
	FindByInscriptionID(context.Context, int64) ([]*Collection, error)
	List(context.Context, ...CollectionListOption) ([]*Collection, error)
	Delete(context.Context, int) error
	Count(context.Context, ...CollectionListOption) (int, error)
}

CollectionRepo is a Greater repo.

type CollectionUsecase

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

CollectionUsecase is a Collection usecase.

func NewCollectionUsecase

func NewCollectionUsecase(repo CollectionRepo, logger log.Logger) *CollectionUsecase

NewCollectionUsecase new a Collection usecase.

func (*CollectionUsecase) CountCollection

func (uc *CollectionUsecase) CountCollection(ctx context.Context, opt *CollectionListOption) (int, error)

CountCollection counts the number of the Collection.

func (*CollectionUsecase) CreateCollection

func (uc *CollectionUsecase) CreateCollection(ctx context.Context, g *Collection) (*Collection, error)

CreateCollection creates a Collection, and returns the new Collection.

func (*CollectionUsecase) DeleteCollection

func (uc *CollectionUsecase) DeleteCollection(ctx context.Context, id int) error

DeleteCollection deletes a Collection.

func (*CollectionUsecase) GetCollection

func (uc *CollectionUsecase) GetCollection(ctx context.Context, id int) (*Collection, error)

GetCollection gets a Collection by the ID.

func (*CollectionUsecase) GetCollectionByInscriptionID

func (uc *CollectionUsecase) GetCollectionByInscriptionID(ctx context.Context, inscriptionID int64) ([]*Collection, error)

func (*CollectionUsecase) GetCollectionByTick

func (uc *CollectionUsecase) GetCollectionByTick(ctx context.Context, p string, tick string) (*Collection, error)

func (*CollectionUsecase) ListCollections

func (uc *CollectionUsecase) ListCollections(ctx context.Context, opt *CollectionListOption) ([]*Collection, error)

ListCollections list all Collections.

func (*CollectionUsecase) UpdateCollection

func (uc *CollectionUsecase) UpdateCollection(ctx context.Context, g *Collection) (*Collection, error)

UpdateCollection updates a Collection, and returns the new Collection.

type Inscription

type Inscription struct {
	ID            int       `json:"id"`
	InscriptionID int64     `json:"inscription_id"`
	UID           string    `json:"uid"`
	Address       string    `json:"address"`
	OutputValue   uint64    `json:"output_value"`
	ContentLength uint64    `json:"content_length"`
	ContentType   string    `json:"content_type"`
	Timestamp     time.Time `json:"timestamp"`
	GenesisHeight uint64    `json:"genesis_height"`
	GenesisFee    uint64    `json:"genesis_fee"`
	GenesisTx     string    `json:"genesis_tx"`
	Location      string    `json:"location"`
	Output        string    `json:"output"`
	Offset        uint64    `json:"offset"`
}

Inscription is a Inscription model.

type InscriptionListOption

type InscriptionListOption struct {
	Limit  int
	Offset int
	Order  string
}

type InscriptionRepo

type InscriptionRepo interface {
	Create(context.Context, *Inscription) (*Inscription, error)
	Update(context.Context, *Inscription) (*Inscription, error)
	FindByInscriptionID(context.Context, int64) (*Inscription, error)
	List(context.Context, ...InscriptionListOption) ([]*Inscription, error)
	Delete(context.Context, int) error
	Count(context.Context, ...InscriptionListOption) (int, error)
}

InscriptionRepo is a Greater repo.

type InscriptionUsecase

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

InscriptionUsecase is a Inscription usecase.

func NewInscriptionUsecase

func NewInscriptionUsecase(repo InscriptionRepo, logger log.Logger) *InscriptionUsecase

NewInscriptionUsecase new a Inscription usecase.

func (*InscriptionUsecase) CountInscriptions

func (uc *InscriptionUsecase) CountInscriptions(ctx context.Context, opt *InscriptionListOption) (int, error)

CountInscriptions counts Inscriptions.

func (*InscriptionUsecase) CreateInscription

func (uc *InscriptionUsecase) CreateInscription(ctx context.Context, g *Inscription) (*Inscription, error)

CreateInscription creates a Inscription, and returns the new Inscription.

func (*InscriptionUsecase) DeleteInscription

func (uc *InscriptionUsecase) DeleteInscription(ctx context.Context, id int) error

DeleteInscription deletes a Inscription.

func (*InscriptionUsecase) FindByInscriptionID

func (uc *InscriptionUsecase) FindByInscriptionID(ctx context.Context, inscriptionID int64) (*Inscription, error)

FindByInscriptionID finds the Inscription by InscriptionID.

func (*InscriptionUsecase) ListInscriptions

func (uc *InscriptionUsecase) ListInscriptions(ctx context.Context, opt *InscriptionListOption) ([]*Inscription, error)

ListInscriptions lists Inscriptions.

func (*InscriptionUsecase) UpdateInscription

func (uc *InscriptionUsecase) UpdateInscription(ctx context.Context, g *Inscription) (*Inscription, error)

UpdateInscription updates a Inscription, and returns the new Inscription.

type RedisRepo

type RedisRepo interface {
	GetLastInscriptionId(ctx context.Context) (int64, error)
	SetLastInscriptionId(ctx context.Context, id int64) error
}

type Token

type Token struct {
	ID             int         `json:"id"`
	P              string      `json:"p"`
	Tick           string      `json:"tick"`
	TokenID        uint64      `json:"token_id"`
	TxHash         string      `json:"tx_hash"`
	BlockHeight    uint64      `json:"block_height"`
	BlockTime      time.Time   `json:"block_time"`
	Address        string      `json:"address"`
	InscriptionID  int64       `json:"inscription_id"`
	InscriptionUID string      `json:"inscription_uid"`
	CollectionID   int         `json:"collection_id"`
	Sig            sig.MintSig `json:"sig,omitempty"`
}

Token is a Token model.

type TokenListOption

type TokenListOption struct {
	Limit  int
	Offset int
	Tick   string
	P      string
	Order  string
}

type TokenRepo

type TokenRepo interface {
	Create(context.Context, *Token) (*Token, error)
	Update(context.Context, *Token) (*Token, error)
	FindByTickTokenID(context.Context, string, string, uint64) (*Token, error)
	FindByInscriptionID(context.Context, int64) ([]*Token, error)
	FindByTickSigUID(context.Context, string, string, string) (*Token, error)
	List(context.Context, ...TokenListOption) ([]*Token, error)
	Delete(context.Context, int) error
	Count(context.Context, ...TokenListOption) (int, error)
}

TokenRepo is a Greater repo.

type TokenUsecase

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

TokenUsecase is a Token usecase.

func NewTokenUsecase

func NewTokenUsecase(repo TokenRepo, logger log.Logger) *TokenUsecase

NewTokenUsecase new a Token usecase.

func (*TokenUsecase) CountTokens

func (uc *TokenUsecase) CountTokens(ctx context.Context, opt *TokenListOption) (int, error)

CountTokens counts Tokens.

func (*TokenUsecase) CreateToken

func (uc *TokenUsecase) CreateToken(ctx context.Context, g *Token) (*Token, error)

CreateToken creates a Token, and returns the new Token.

func (*TokenUsecase) DeleteToken

func (uc *TokenUsecase) DeleteToken(ctx context.Context, id int) error

DeleteToken deletes a Token.

func (*TokenUsecase) FindByInscriptionID

func (uc *TokenUsecase) FindByInscriptionID(ctx context.Context, inscriptionID int64) ([]*Token, error)

FindByInscriptionID finds the Token by InscriptionID.

func (*TokenUsecase) FindByTickSigUID added in v0.2.0

func (uc *TokenUsecase) FindByTickSigUID(ctx context.Context, p, tick, sigUID string) (*Token, error)

FindByTickSigUID finds the Token by Tick and SigUID.

func (*TokenUsecase) FindByTickTokenID

func (uc *TokenUsecase) FindByTickTokenID(ctx context.Context, p, tick string, tokenID uint64) (*Token, error)

FindByTickTokenID finds the Token by Tick and TokenID.

func (*TokenUsecase) ListTokens

func (uc *TokenUsecase) ListTokens(ctx context.Context, opt *TokenListOption) ([]*Token, error)

ListTokens lists Tokens.

func (*TokenUsecase) UpdateToken

func (uc *TokenUsecase) UpdateToken(ctx context.Context, g *Token) (*Token, error)

UpdateToken updates a Token, and returns the new Token.

Jump to

Keyboard shortcuts

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