config

package
v0.0.0-...-d2aac13 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrParseConfig         = errors.New("unable to parse config")
	ErrUnmarshalYamlFailed = errors.New("unable to unmarshal yaml config")
	ErrUnmarshalJsonFailed = errors.New("unable to unmarshal json config")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	AppName    string `yaml:"app_name" json:"app_name"`
	Hash       string
	Contracts  []Contract `yaml:"contracts" json:"contracts"`
	StartBlock uint64     `yaml:"start_block" json:"start_block"`
}

func FromJson

func FromJson(data []byte) (*Config, error)

Create config from json input

func FromYamlFile

func FromYamlFile(file string) (*Config, error)

Create config from yaml input

func NewCongig

func NewCongig() *Config

func (*Config) ComputeHash

func (c *Config) ComputeHash() *Config

func (*Config) GetContract

func (c *Config) GetContract(address string) *Contract

type Contract

type Contract struct {
	Events  map[string]string `yaml:"events" json:"events"`
	Address string            `yaml:"address" json:"address"`
	Name    string            `yaml:"name" json:"name"`
}

type ContractRepository

type ContractRepository interface {
	SaveConfig(Config) error
	GetConfigs() ([]Config, error)
	GetConfig(string) (*Config, error)
}

type NatsContractRepository

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

func NewPebbleContractRepository

func NewPebbleContractRepository(s storage.Storage) *NatsContractRepository

func (*NatsContractRepository) GetConfig

func (r *NatsContractRepository) GetConfig(name string) (*Config, error)

func (*NatsContractRepository) GetConfigs

func (r *NatsContractRepository) GetConfigs() ([]Config, error)

func (*NatsContractRepository) SaveConfig

func (r *NatsContractRepository) SaveConfig(c Config) error

Jump to

Keyboard shortcuts

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