load

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Post = dataloader.NewPostLoader(dataloader.PostLoaderConfig{
	Wait: defaultWait,
	Fetch: func(txHashStrings []string) ([]*model.Post, []error) {
		var posts = make([]*model.Post, len(txHashStrings))
		var errors = make([]error, len(txHashStrings))
		ctx, cancel := context.WithTimeout(context.Background(), time.Second)
		defer cancel()
		for i, txHashString := range txHashStrings {
			txHash, err := chainhash.NewHashFromStr(txHashString)
			if err != nil {
				errors[i] = fmt.Errorf("error getting tx hash from string; %w", err)
				continue
			}
			memoPost, err := memo.GetPost(ctx, *txHash)
			if err != nil && !client.IsEntryNotFoundError(err) {
				errors[i] = fmt.Errorf("error getting lock memo post; %w", err)
				continue
			}
			if memoPost == nil {
				errors[i] = fmt.Errorf("error post not found: %s; %w", txHashString, postNotFoundError)
				continue
			}
			posts[i] = &model.Post{
				TxHash:  model.Hash(*txHash),
				Address: memoPost.Addr,
				Text:    memoPost.Post,
			}
		}
		return posts, errors
	},
})
View Source
var TxMissingError = fmt.Errorf("error tx missing")

Functions

func AttachToBlocks

func AttachToBlocks(ctx context.Context, fields []Field, blocks []*model.Block) error

func AttachToInputs

func AttachToInputs(ctx context.Context, fields []Field, inputs []*model.TxInput) error

func AttachToLocks

func AttachToLocks(ctx context.Context, fields []Field, locks []*model.Lock) error

func AttachToMemoFollows

func AttachToMemoFollows(ctx context.Context, fields []Field, follows []*model.Follow) error

func AttachToMemoRoomFollows

func AttachToMemoRoomFollows(ctx context.Context, fields []Field, roomFollows []*model.RoomFollow) error

func AttachToMemoRooms

func AttachToMemoRooms(ctx context.Context, fields []Field, rooms []*model.Room) error

func AttachToOutputs

func AttachToOutputs(ctx context.Context, fields Fields, outputs []*model.TxOutput) error

func AttachToSlpBatons

func AttachToSlpBatons(ctx context.Context, fields []Field, slpBatons []*model.SlpBaton) error

func AttachToSlpGeneses

func AttachToSlpGeneses(ctx context.Context, fields []Field, slpGeneses []*model.SlpGenesis) error

func AttachToSlpOutputs

func AttachToSlpOutputs(ctx context.Context, fields []Field, slpOutputs []*model.SlpOutput) error

func AttachToTxs

func AttachToTxs(ctx context.Context, fields []Field, txs []*model.Tx) error

func GetLock

func GetLock(ctx context.Context, address model.Address) (*model.Lock, error)

func GetProfile

func GetProfile(ctx context.Context, address [25]byte) (*model.Profile, error)

func GetTx

func GetTx(ctx context.Context, txHash [32]byte) (*model.Tx, error)

func GetTxByString

func GetTxByString(ctx context.Context, txHash string) (*model.Tx, error)

func IsPostNotFoundError

func IsPostNotFoundError(err error) bool

func PrintFields

func PrintFields(fields []Field, layer int)

Types

type Blocks

type Blocks struct {
	Blocks []*model.Block
	// contains filtered or unexported fields
}

func (*Blocks) AddError

func (b *Blocks) AddError(err error)

func (*Blocks) AttachHeights

func (b *Blocks) AttachHeights()

func (*Blocks) AttachInfos

func (b *Blocks) AttachInfos()

func (*Blocks) AttachRaws

func (b *Blocks) AttachRaws()

func (*Blocks) AttachTxs

func (b *Blocks) AttachTxs()

func (*Blocks) GetBlockHashes

func (b *Blocks) GetBlockHashes() [][32]byte

func (*Blocks) HasField

func (b *Blocks) HasField(checks []string) bool

type Field

type Field struct {
	Name      string
	Arguments map[string]interface{}
	Fields    Fields
}

func GetPrefixFields

func GetPrefixFields(fields []Field, prefix string) (prefixFields []Field)

type Fields

type Fields []Field

func GetFields

func GetFields(ctx context.Context) Fields

func (Fields) GetField

func (f Fields) GetField(check string) Field

func (Fields) HasField

func (f Fields) HasField(check string) bool

func (Fields) HasFieldAny

func (f Fields) HasFieldAny(checks []string) bool

func (Fields) Print

func (f Fields) Print(layer int)

type Inputs

type Inputs struct {
	Inputs []*model.TxInput
	// contains filtered or unexported fields
}

func (*Inputs) AddError

func (b *Inputs) AddError(err error)

func (*Inputs) AttachScriptSequence

func (i *Inputs) AttachScriptSequence()

func (*Inputs) AttachTxOutputs

func (i *Inputs) AttachTxOutputs()

func (*Inputs) AttachTxs

func (i *Inputs) AttachTxs()

func (*Inputs) HasField

func (b *Inputs) HasField(checks []string) bool

type Lock

type Lock struct {
	Locks []*model.Lock
	// contains filtered or unexported fields
}

func (*Lock) AddError

func (b *Lock) AddError(err error)

func (*Lock) AttachProfiles

func (l *Lock) AttachProfiles()

func (*Lock) AttachTxs

func (l *Lock) AttachTxs()

func (*Lock) GetLockAddrs

func (l *Lock) GetLockAddrs() [][25]byte

func (*Lock) HasField

func (b *Lock) HasField(checks []string) bool

type MemoFollowAttach

type MemoFollowAttach struct {
	Follows []*model.Follow
	// contains filtered or unexported fields
}

func (*MemoFollowAttach) AddError

func (b *MemoFollowAttach) AddError(err error)

func (*MemoFollowAttach) AttachFollowLocks

func (a *MemoFollowAttach) AttachFollowLocks()

func (*MemoFollowAttach) AttachLocks

func (a *MemoFollowAttach) AttachLocks()

func (*MemoFollowAttach) AttachTxs

func (a *MemoFollowAttach) AttachTxs()

func (*MemoFollowAttach) HasField

func (b *MemoFollowAttach) HasField(checks []string) bool

type MemoRoomAttach

type MemoRoomAttach struct {
	Rooms []*model.Room
	// contains filtered or unexported fields
}

func (*MemoRoomAttach) AddError

func (b *MemoRoomAttach) AddError(err error)

func (*MemoRoomAttach) AttachFollowers

func (o *MemoRoomAttach) AttachFollowers()

func (*MemoRoomAttach) AttachPosts

func (o *MemoRoomAttach) AttachPosts()

func (*MemoRoomAttach) GetRoomNames

func (o *MemoRoomAttach) GetRoomNames() []string

func (*MemoRoomAttach) HasField

func (b *MemoRoomAttach) HasField(checks []string) bool

type MemoRoomFollowAttach

type MemoRoomFollowAttach struct {
	RoomFollows []*model.RoomFollow
	// contains filtered or unexported fields
}

func (*MemoRoomFollowAttach) AddError

func (b *MemoRoomFollowAttach) AddError(err error)

func (*MemoRoomFollowAttach) AttachLocks

func (a *MemoRoomFollowAttach) AttachLocks()

func (*MemoRoomFollowAttach) AttachRooms

func (a *MemoRoomFollowAttach) AttachRooms()

func (*MemoRoomFollowAttach) AttachTxs

func (a *MemoRoomFollowAttach) AttachTxs()

func (*MemoRoomFollowAttach) HasField

func (b *MemoRoomFollowAttach) HasField(checks []string) bool

type Outputs

type Outputs struct {
	Outputs     []*model.TxOutput
	DetailsWait sync.WaitGroup
	// contains filtered or unexported fields
}

func (*Outputs) AddError

func (b *Outputs) AddError(err error)

func (*Outputs) AttachInfo

func (o *Outputs) AttachInfo()

func (*Outputs) AttachLocks

func (o *Outputs) AttachLocks()

func (*Outputs) AttachSlpBatons

func (o *Outputs) AttachSlpBatons()

func (*Outputs) AttachSlps

func (o *Outputs) AttachSlps()

func (*Outputs) AttachSpends

func (o *Outputs) AttachSpends()

func (*Outputs) AttachTxs

func (o *Outputs) AttachTxs()

func (*Outputs) GetOuts

func (o *Outputs) GetOuts(checkScript bool) []memo.Out

func (*Outputs) HasField

func (b *Outputs) HasField(checks []string) bool

type SlpBatons

type SlpBatons struct {
	SlpBatons []*model.SlpBaton
	// contains filtered or unexported fields
}

func (*SlpBatons) AddError

func (b *SlpBatons) AddError(err error)

func (*SlpBatons) AttachGeneses

func (o *SlpBatons) AttachGeneses()

func (*SlpBatons) AttachOutputs

func (o *SlpBatons) AttachOutputs()

func (*SlpBatons) GetOuts

func (o *SlpBatons) GetOuts() []memo.Out

func (*SlpBatons) GetTokenHashes

func (o *SlpBatons) GetTokenHashes() [][32]byte

func (*SlpBatons) HasField

func (b *SlpBatons) HasField(checks []string) bool

type SlpGeneses

type SlpGeneses struct {
	SlpGeneses []*model.SlpGenesis
	// contains filtered or unexported fields
}

func (*SlpGeneses) AddError

func (b *SlpGeneses) AddError(err error)

func (*SlpGeneses) AttachSlpBatons

func (o *SlpGeneses) AttachSlpBatons()

func (*SlpGeneses) AttachSlpOutputs

func (o *SlpGeneses) AttachSlpOutputs()

func (*SlpGeneses) AttachTxs

func (o *SlpGeneses) AttachTxs()

func (*SlpGeneses) GetBatonOuts

func (o *SlpGeneses) GetBatonOuts() []memo.Out

func (*SlpGeneses) GetTokenOuts

func (o *SlpGeneses) GetTokenOuts() []memo.Out

func (*SlpGeneses) HasField

func (b *SlpGeneses) HasField(checks []string) bool

type SlpOutputs

type SlpOutputs struct {
	SlpOutputs []*model.SlpOutput
	// contains filtered or unexported fields
}

func (*SlpOutputs) AddError

func (b *SlpOutputs) AddError(err error)

func (*SlpOutputs) AttachGeneses

func (o *SlpOutputs) AttachGeneses()

func (*SlpOutputs) AttachOutputs

func (o *SlpOutputs) AttachOutputs()

func (*SlpOutputs) GetOuts

func (o *SlpOutputs) GetOuts() []memo.Out

func (*SlpOutputs) GetTokenHashes

func (o *SlpOutputs) GetTokenHashes() [][32]byte

func (*SlpOutputs) HasField

func (b *SlpOutputs) HasField(checks []string) bool

type Tx

type Tx struct {
	Txs         []*model.Tx
	DetailsWait sync.WaitGroup
	// contains filtered or unexported fields
}

func (*Tx) AddError

func (b *Tx) AddError(err error)

func (*Tx) AttachBlocks

func (t *Tx) AttachBlocks()

func (*Tx) AttachInfo

func (t *Tx) AttachInfo()

func (*Tx) AttachInputs

func (t *Tx) AttachInputs()

func (*Tx) AttachOutputs

func (t *Tx) AttachOutputs()

func (*Tx) AttachRaws

func (t *Tx) AttachRaws()

func (*Tx) AttachSeens

func (t *Tx) AttachSeens()

func (*Tx) AttachToOutputs

func (t *Tx) AttachToOutputs()

func (*Tx) GetTxHashes

func (t *Tx) GetTxHashes(checkVersion, checkSeen bool) [][32]byte

func (*Tx) HasField

func (b *Tx) HasField(checks []string) bool

Jump to

Keyboard shortcuts

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