config

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Key        string      `yaml:"key"`
	Action     ActionRedis `yaml:"action"`
	Conditions []string    `yaml:"conditions"` // TODO: improve parser/lexer engine
	// contains filtered or unexported fields
}

Action represents a redis action section

func (*Action) ConditionsCheck

func (a *Action) ConditionsCheck() bool

ConditionsCheck checks conditions

func (*Action) FinalKey

func (a *Action) FinalKey() (string, error)

FinalKey returns the final key after template

func (*Action) SetContent

func (a *Action) SetContent(content []byte)

SetContent sets content

func (*Action) UnmarshalYAML

func (a *Action) UnmarshalYAML(u func(interface{}) error) error

UnmarshalYAML returns an unmarshal YAML implementation

type ActionRedis

type ActionRedis string

ActionRedis represents a typed redis action

const (
	// ActionIncrement returns increment action for redis
	ActionIncrement ActionRedis = "increment"
	// ActionDecrement returns decrement action for redis
	ActionDecrement ActionRedis = "decrement"
	// ActionDelete returns delete action for redis
	ActionDelete ActionRedis = "delete"
)

type Config

type Config struct {
	Version string `yaml:"version"`

	Rules []Rule `yaml:"rules"`
}

Config represents the config file structured

func FromFile

func FromFile(file string, log logger.Logger) (c *Config, err error)

FromFile converts the configuration file to struct TODO: Create clean errors on config (most readable)

func Unmarshal

func Unmarshal(in []byte, log logger.Logger) (c *Config, err error)

Unmarshal decodes configuration

type RabbitMQ

type RabbitMQ struct {
	ExchangeName string `yaml:"exchangeName"`
	RoutingKey   string `yaml:"routingKey"`
	QueueName    string `yaml:"queueName"`

	Exchange exchange.Exchange `yaml:"exchange"`
	Bind     bind.Bind         `yaml:"bind"`
	Queue    queue.Queue       `yaml:"queue"`
}

RabbitMQ represents a RabbitMQ section

func (*RabbitMQ) UnmarshalYAML

func (r *RabbitMQ) UnmarshalYAML(u func(interface{}) error) error

UnmarshalYAML returns an unmarshal YAML implementation

type Redis

type Redis struct {
	Actions []Action `yaml:"actions"`
}

Redis represents a Redis section

type Rule

type Rule struct {
	RabbitMQ RabbitMQ `yaml:"rabbitmq"`
	Redis    Redis    `yaml:"redis"`
}

Rule represents a Rule section

Jump to

Keyboard shortcuts

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