observations

package
v0.0.0-...-efbd42f Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package observations handle the request of observations data from governor endpoint defined in the api.

Package observations handle the request of observations data from governor endpoint defined in the api.

Package observations handle the request of observations data from governor endpoint defined in the api.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ObservationDoc

type ObservationDoc struct {
	ID           string      `bson:"_id" json:"id"`
	EmitterChain vaa.ChainID `bson:"emitterChain" json:"emitterChain"`
	EmitterAddr  string      `bson:"emitterAddr" json:"emitterAddr"`
	Sequence     string      `bson:"sequence" json:"sequence"`
	Hash         []byte      `bson:"hash" json:"hash"`
	TxHash       []byte      `bson:"txHash" json:"txHash"`
	PhylaxAddr   string      `bson:"phylaxAddr" json:"phylaxAddr"`
	Signature    []byte      `bson:"signature" json:"signature"`
	UpdatedAt    *time.Time  `bson:"updatedAt" json:"updatedAt"`
	IndexedAt    *time.Time  `bson:"indexedAt" json:"indexedAt"`
}

ObservationDoc represent an observation document.

func (*ObservationDoc) MarshalJSON

func (o *ObservationDoc) MarshalJSON() ([]byte, error)

MarshalJSON interface implementation for ObservationDoc.

type ObservationQuery

type ObservationQuery struct {
	pagination.Pagination
	// contains filtered or unexported fields
}

ObservationQuery respresent a query for the observation mongodb document.

func Query

func Query() *ObservationQuery

Query create a new ObservationQuery with default pagination vaues.

func (*ObservationQuery) SetChain

func (q *ObservationQuery) SetChain(chainID vaa.ChainID) *ObservationQuery

SetEmitter set the chainId field of the ObservationQuery struct.

func (*ObservationQuery) SetEmitter

func (q *ObservationQuery) SetEmitter(emitter string) *ObservationQuery

SetEmitter set the emitter field of the ObservationQuery struct.

func (*ObservationQuery) SetHash

func (q *ObservationQuery) SetHash(hash []byte) *ObservationQuery

SetHash set the hash field of the ObservationQuery struct.

func (*ObservationQuery) SetPagination

SetPagination set the pagination field of the ObservationQuery struct.

func (*ObservationQuery) SetPhylaxAddr

func (q *ObservationQuery) SetPhylaxAddr(phylaxAddr string) *ObservationQuery

SetPhylaxAddr set the phylaxAddr field of the ObservationQuery struct.

func (*ObservationQuery) SetSequence

func (q *ObservationQuery) SetSequence(seq string) *ObservationQuery

SetSequence set the sequence field of the ObservationQuery struct.

type Repository

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

Repository definition.

func NewRepository

func NewRepository(db *mongo.Database, logger *zap.Logger) *Repository

NewRepository create a new Repository.

func (*Repository) Find

Find get a list of ObservationDoc pointers. The input parameter [q *ObservationQuery] define the filters to apply in the query.

func (*Repository) FindOne

Find get ObservationDoc pointer. The input parameter [q *ObservationQuery] define the filters to apply in the query.

type Service

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

Service definition.

func NewService

func NewService(dao *Repository, logger *zap.Logger) *Service

NewService create a new Service.

func (*Service) FindAll

func (s *Service) FindAll(ctx context.Context, p *pagination.Pagination) ([]*ObservationDoc, error)

FindAll get all the observations.

func (*Service) FindByChain

func (s *Service) FindByChain(ctx context.Context, chain vaa.ChainID, p *pagination.Pagination) ([]*ObservationDoc, error)

FindByChain get all the observations by chainID.

func (*Service) FindByEmitter

func (s *Service) FindByEmitter(
	ctx context.Context,
	chain vaa.ChainID,
	emitter *types.Address,
	p *pagination.Pagination,
) ([]*ObservationDoc, error)

FindByEmitter get all the observations by chainID and emitter address.

func (*Service) FindByVAA

func (s *Service) FindByVAA(
	ctx context.Context,
	chain vaa.ChainID,
	emitter *types.Address,
	seq string,
	p *pagination.Pagination,
) ([]*ObservationDoc, error)

FindByVAA get all the observations for a VAA (chainID, emitter addrress and sequence number).

func (*Service) FindOne

func (s *Service) FindOne(
	ctx context.Context,
	chainID vaa.ChainID,
	emitterAddr *types.Address,
	seq string,
	signerAddr *vaa.Address,
	hash []byte,
) (*ObservationDoc, error)

FindOne get a observation by chainID, emitter address, sequence, signer address and hash.

Jump to

Keyboard shortcuts

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