settings

package
v1.0.49 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository interface {
	// Core operations
	Create(ctx context.Context, setting *Setting) error
	Get(ctx context.Context, id string) (*Setting, error)
	Update(ctx context.Context, setting *Setting) error
	Delete(ctx context.Context, id string) error

	// Operations by key
	GetByKey(ctx context.Context, key types.SettingKey) (*Setting, error)
	GetTenantLevelSettingByKey(ctx context.Context, key types.SettingKey) (*Setting, error)
	DeleteByKey(ctx context.Context, key types.SettingKey) error
	DeleteTenantLevelSettingByKey(ctx context.Context, key types.SettingKey) error

	// Config operations
	ListAllTenantEnvSettingsByKey(ctx context.Context, key types.SettingKey) ([]*types.TenantEnvConfig, error)
	GetAllTenantEnvSubscriptionSettings(ctx context.Context) ([]*types.TenantEnvSubscriptionConfig, error)
}

Repository defines the interface for settings persistence operations

type Setting

type Setting struct {
	// ID is the unique identifier for the setting
	ID string `json:"id"`

	// Key is the setting key
	Key types.SettingKey `json:"key"`

	// Value is the JSON value of the setting
	Value map[string]interface{} `json:"value"`

	// EnvironmentID is the environment identifier for the setting
	EnvironmentID string `json:"environment_id"`

	types.BaseModel
}

Setting represents a tenant and environment specific configuration setting

func FromEnt

func FromEnt(s *ent.Settings) *Setting

FromEnt converts an ent setting to a domain setting

func FromEntList

func FromEntList(settings []*ent.Settings) []*Setting

FromEntList converts a list of ent settings to domain settings

func (*Setting) GetValue

func (s *Setting) GetValue(key string, target interface{}) error

GetValue retrieves a value by key and unmarshals it into the target

func (*Setting) SetValue

func (s *Setting) SetValue(key string, value interface{})

SetValue sets a value for a specific key

func (*Setting) Validate

func (s *Setting) Validate() error

Validate validates the setting

Jump to

Keyboard shortcuts

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