storage

package
v0.0.0-...-9d201ce Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Models = []storage.Model{
	&State{},
	&Address{},
	&StarknetId{},
	&Domain{},
	&Subdomain{},
	&Field{},
}

Models - list all models

Functions

This section is empty.

Types

type Address

type Address struct {
	bun.BaseModel `bun:"address" comment:"Address table"`

	Id      uint64  `bun:"id,notnull,type:bigint,pk"                         comment:"Unique internal identity"`
	Hash    []byte  `comment:"Starknet hash address"`
	Height  uint64  `comment:"Block number of the first address occurrence."`
	ClassId *uint64 `bun:",nullzero"                                         comment:"Internal class identity"`
}

Address -

func (Address) TableName

func (Address) TableName() string

TableName -

type Domain

type Domain struct {
	bun.BaseModel `bun:"domain" comment:"Domains table"`

	Id          uint64          `bun:"id,pk,autoincrement"              comment:"Unique internal identity"`
	AddressId   uint64          `comment:"Address id from main indexer"`
	AddressHash []byte          `comment:"Address hash"`
	Domain      string          `bun:",unique"                          comment:"Domain string"`
	Owner       decimal.Decimal `bun:",type:numeric"                    comment:"Owner's starknet id"`
	Expiry      time.Time       `comment:"Expiration time"`

	Address    Address    `bun:"-" hasura:"table:address,field:address_id,remote_field:id,type:oto,name:address"`
	StarknetId StarknetId `bun:"-" hasura:"table:starknet_id,field:owner,remote_field:id,type:oto,name:starknet_id"`
}

Domain -

func (Domain) TableName

func (Domain) TableName() string

TableName -

type Field

type Field struct {
	bun.BaseModel `bun:"field" comment:"Field table"`

	Id        uint64          `bun:"id,pk,autoincrement" comment:"Unique internal identity"`
	OwnerId   decimal.Decimal `bun:",type:numeric"       comment:"Starknet Id (token id)"`
	Namespace FieldNamespace  `bun:",type:SMALLINT"      comment:"Kind of namespace"`
	Name      string          `comment:"Field name"`
	Value     []byte          `comment:"Field value"`

	Owner StarknetId `bun:"-" hasura:"table:starknet_id,field:owner_id,remote_field:id,type:oto,name:starknet_id"`
}

Field

func (Field) TableName

func (Field) TableName() string

TableName -

type FieldNamespace

type FieldNamespace int

FieldNamespace -

const (
	FieldNamespaceVerifier FieldNamespace = iota + 1
	FieldNamespaceUser
)

FieldNamespace values

type IAddress

type IAddress interface {
	storage.Table[*Address]

	GetByHash(ctx context.Context, hash []byte) (Address, error)
}

IAddress -

type IDomain

type IDomain interface {
	storage.Table[*Domain]
}

IDomain -

type IField

type IField interface {
	storage.Table[*Field]
}

IField -

type IStarknetId

type IStarknetId interface {
	storage.Table[*StarknetId]
}

IStarknetId -

type IState

type IState interface {
	storage.Table[*State]

	ByName(ctx context.Context, name string) (State, error)
}

IState -

type ISubdomain

type ISubdomain interface {
	storage.Table[*Subdomain]

	GetByResolverId(ctx context.Context, resolverId uint64) (result Subdomain, err error)
}

ISubdomain -

type StarknetId

type StarknetId struct {
	bun.BaseModel `bun:"starknet_id" comment:"Starknet id table"`

	Id           uint64          `bun:"id,pk,autoincrement"             comment:"Unique internal identity"`
	StarknetId   decimal.Decimal `bun:",unique,type:numeric"            comment:"Starknet Id (token id)"`
	OwnerAddress []byte          `comment:"Address hash of token owner"`
	OwnerId      uint64          `comment:"Owner identity of address"`

	Owner  Address `bun:"-" hasura:"table:address,field:owner_id,remote_field:id,type:oto,name:owner"`
	Fields []Field `bun:"-" hasura:"table:field,field:starknet_id,remote_field:owner_id,type:otm,name:fields"`
}

StarknetId -

func (StarknetId) TableName

func (StarknetId) TableName() string

TableName -

type State

type State struct {
	bun.BaseModel `bun:"state" comment:"Table contains current indexer's state"`

	ID         uint64    `bun:"id,pk,autoincrement"    comment:"Unique internal identity"`
	Name       string    `bun:",unique:state_name"     comment:"Indexer human-readable name"`
	LastHeight uint64    `comment:"Last block height"`
	LastTime   time.Time `comment:"Time of last block"`
}

State -

func (State) TableName

func (State) TableName() string

TableName -

type Subdomain

type Subdomain struct {
	bun.BaseModel `bun:"subdomain" comment:"Subdomain's table"`

	Id                 uint64    `bun:"id,pk,autoincrement"                                    comment:"Unique internal identity"`
	RegistrationHeight uint64    `comment:"Height of first event about subdomain registration"`
	RegistrationDate   time.Time `comment:"Date of first event about subdomain registration"`
	ResolverId         uint64    `comment:"Resolver's address id from main indexer"`
	Subdomain          string    `bun:",unique"                                                comment:"Subdomain string"`

	Resolver Address `bun:"-" hasura:"table:address,field:resolver_id,remote_field:id,type:oto,name:resolver"`
}

Subdomain -

func (Subdomain) TableName

func (Subdomain) TableName() string

TableName -

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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