shared

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrFailedTo

func ErrFailedTo(action string, err error) error

ErrFailedTo creates a "failed to X" error

func ErrInvalid

func ErrInvalid(what string, value interface{}) error

ErrInvalid creates an "invalid X" error

func ErrMissingParam

func ErrMissingParam(param string) error

ErrMissingParam creates a "missing required parameter" error

func ErrNotFound

func ErrNotFound(what string) error

ErrNotFound creates a "X not found" error

func GenerateCalibrationID added in v0.3.0

func GenerateCalibrationID() string

GenerateCalibrationID generates a unique ID for calibration tasks

func GenerateEmergingID added in v0.3.0

func GenerateEmergingID() string

GenerateEmergingID generates a unique ID for emerging patterns

func GenerateFixID added in v0.3.0

func GenerateFixID() string

GenerateFixID generates a unique ID for fixes

func GenerateID added in v0.3.0

func GenerateID(prefix string) string

GenerateID generates a unique ID with the given prefix

func GenerateMemoryID added in v0.3.0

func GenerateMemoryID() string

GenerateMemoryID generates a unique ID for memory entries

func GeneratePracticeID added in v0.3.0

func GeneratePracticeID(practiceID string) string

GeneratePracticeID generates a unique ID for practices

func GenerateResourceID added in v0.3.0

func GenerateResourceID(uri string) string

GenerateResourceID generates a unique ID for resources with URI

func GenerateToolID added in v0.3.0

func GenerateToolID(pattern string) string

GenerateToolID generates a unique ID for tool patterns

func GenerateWorkflowID added in v0.3.0

func GenerateWorkflowID(workflow string, step int) string

GenerateWorkflowID generates a unique ID for workflow steps

func NewRedisClient added in v0.3.0

func NewRedisClient(cfg *RedisConfig) (*redis.Client, error)

NewRedisClient creates a new Redis client with the given configuration

func NewTestRedisClient added in v0.3.0

func NewTestRedisClient() (*redis.Client, error)

NewTestRedisClient creates a Redis client for testing

Types

type RedisConfig added in v0.3.0

type RedisConfig struct {
	Addr         string
	MaxRetries   int
	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

RedisConfig holds configuration for Redis client

func DefaultRedisConfig added in v0.3.0

func DefaultRedisConfig(addr string) *RedisConfig

DefaultRedisConfig returns production-ready Redis configuration

func TestRedisConfig added in v0.3.0

func TestRedisConfig() *RedisConfig

TestRedisConfig returns simple Redis configuration for testing

type Validator added in v0.2.0

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

Validator provides common validation functions

func NewValidator added in v0.2.0

func NewValidator() *Validator

NewValidator creates a new validator

func (*Validator) Error added in v0.2.0

func (v *Validator) Error() error

Error returns the validation error if any

func (*Validator) Errors added in v0.2.0

func (v *Validator) Errors() []string

Errors returns all validation errors

func (*Validator) HasErrors added in v0.2.0

func (v *Validator) HasErrors() bool

HasErrors returns true if validation errors exist

func (*Validator) RequireNonEmpty added in v0.2.0

func (v *Validator) RequireNonEmpty(field string, value string) *Validator

RequireNonEmpty validates that a string is not empty

func (*Validator) RequirePositive added in v0.2.0

func (v *Validator) RequirePositive(field string, value int) *Validator

RequirePositive validates that a value is positive

func (*Validator) RequireRange added in v0.2.0

func (v *Validator) RequireRange(field string, value, min, max float64) *Validator

RequireRange validates that a value is within a range

Jump to

Keyboard shortcuts

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