redis

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ComponentType = "redis seed"

ComponentType represents the type of the redis seed component.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entries

type Entries struct {
	HSet []*HSet `json:"hset,omitempty"`
	Set  []*Set  `json:"set,omitempty"`
}

Entries contains a list of HSet and Set entries to set in redis.

type HSet

type HSet struct {
	Key    string            `json:"key"`
	Values map[string]string `json:"values"`
	TTL    time.Duration     `json:"ttl"`
}

HSet Represents a key-value pair to set in a redis hash.

type SeedComponent

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

SeedComponent is a component for seeding redis with data.

func NewSeedComponent

func NewSeedComponent(config SeedConfig) *SeedComponent

NewSeedComponent creates a new SeedComponent instance.

func (*SeedComponent) AttachEnvironment

func (r *SeedComponent) AttachEnvironment(_ context.Context, _ *envite.Environment, writer *envite.Writer) error

func (*SeedComponent) Cleanup

func (r *SeedComponent) Cleanup(context.Context) error

func (*SeedComponent) Config

func (r *SeedComponent) Config() any

func (*SeedComponent) Prepare

func (r *SeedComponent) Prepare(context.Context) error

func (*SeedComponent) Start

func (r *SeedComponent) Start(ctx context.Context) error

func (*SeedComponent) Status

func (*SeedComponent) Stop

func (*SeedComponent) Type

func (r *SeedComponent) Type() string

type SeedConfig

type SeedConfig struct {
	// Address - a valid redis server address to connect to
	Address string `json:"address,omitempty"`

	// ClientProvider - can be used as an alternative to Address, provides a redis client to use.
	// available only via code, not available in config files.
	// if both ClientProvider and Address are provided, ClientProvider is used.
	ClientProvider func() (*redis.Client, error) `json:"-"`

	// Entries - a list of entries to set in redis
	Entries *Entries `json:"entries"`
}

SeedConfig represents the configuration for the redis seed component.

type Set

type Set struct {
	Key   string        `json:"key,omitempty"`
	Value string        `json:"value"`
	TTL   time.Duration `json:"ttl"`
}

Set Represents a key-value pair to set in redis.

Jump to

Keyboard shortcuts

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