store

package
v0.0.0-...-c1a7e98 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(NewStore, wire.Bind(new(IStore), new(*datastore)))

ProviderSet is a Wire provider set that initializes new datastore instances and binds the IStore interface to the actual datastore type.

View Source
var (
	S *datastore
)

Singleton instance variables.

Functions

func NewStore

func NewStore(db *gorm.DB) *datastore

NewStore initializes a new datastore instance using the provided DB gorm instance. It also creates a singleton instance for the datastore.

Types

type ByOrder

type ByOrder []*model.ConfigurationM

func (ByOrder) Len

func (o ByOrder) Len() int

func (ByOrder) Less

func (o ByOrder) Less(i, j int) bool

func (ByOrder) Swap

func (o ByOrder) Swap(i, j int)

type ConfigurationStore

type ConfigurationStore interface {
	// Create adds a new user record to the database.
	Create(ctx context.Context, cfg *model.ConfigurationM) error
	// CreateBatch adds new users record to the database.
	CreateBatch(ctx context.Context, cfgs []*model.ConfigurationM) error
	// List returns a slice of user records based on the specified query conditions.
	List(ctx context.Context, templateCode string, opts ...meta.ListOption) (int64, []*model.ConfigurationM, error)
	// Get retrieves a user record by userID and username.
	Get(ctx context.Context, userID string, username string) (*model.ConfigurationM, error)
	// Update modifies an existing user record.
	Update(ctx context.Context, cfg *model.ConfigurationM) error
	// Delete removes a user record using the provided filters.
	Delete(ctx context.Context, filters map[string]any) error

	// Extensions
	// Fetch retrieves a user record using provided filters.
	Fetch(ctx context.Context, filters map[string]any) (*model.ConfigurationM, error)
	// GetByUsername retrieves a user record using username as the query condition.
	GetByUsername(ctx context.Context, username string) (*model.ConfigurationM, error)
}

ConfigurationStore defines the interface for managing user data storage.

type HistoryStore

type HistoryStore interface {
	// Create adds a new user record to the database.
	Create(ctx context.Context, history *model.HistoryM) error
	// List returns a slice of user records based on the specified query conditions.
	List(ctx context.Context, opts ...meta.ListOption) (int64, []*model.HistoryM, error)
	// Get retrieves a user record by userID and username.
	Get(ctx context.Context, userID string, username string) (*model.HistoryM, error)
	// Update modifies an existing user record.
	Update(ctx context.Context, history *model.HistoryM) error
	// Delete removes a user record using the provided filters.
	Delete(ctx context.Context, filters map[string]any) error

	// Extensions
	// Fetch retrieves a user record using provided filters.
	Fetch(ctx context.Context, filters map[string]any) (*model.HistoryM, error)
	// GetByUsername retrieves a user record using username as the query condition.
	GetByUsername(ctx context.Context, username string) (*model.HistoryM, error)
}

HistoryStore defines the interface for managing user data storage.

type IStore

type IStore interface {
	TX(context.Context, func(ctx context.Context) error) error
	Templates() TemplateStore
	Configurations() ConfigurationStore
	Histories() HistoryStore
	Interactions() InteractionStore
}

IStore is an interface that represents methods required to be implemented by a Store implementation.

type InteractionStore

type InteractionStore interface {
	// Create adds a new user record to the database.
	Create(ctx context.Context, user *model.InteractionM) error
	// List returns a slice of user records based on the specified query conditions.
	List(ctx context.Context, opts ...meta.ListOption) (int64, []*model.InteractionM, error)
	// Get retrieves a user record by userID and username.
	Get(ctx context.Context, userID string, username string) (*model.InteractionM, error)
	// Update modifies an existing user record.
	Update(ctx context.Context, user *model.InteractionM) error
	// Delete removes a user record using the provided filters.
	Delete(ctx context.Context, filters map[string]any) error

	// Extensions
	// Fetch retrieves a user record using provided filters.
	Fetch(ctx context.Context, filters map[string]any) (*model.InteractionM, error)
	// GetByUsername retrieves a user record using username as the query condition.
	GetByUsername(ctx context.Context, username string) (*model.InteractionM, error)
}

InteractionStore defines the interface for managing user data storage.

type TemplateStore

type TemplateStore interface {
	// Create adds a new user record to the database.
	Create(ctx context.Context, user *model.TemplateM) error
	// List returns a slice of user records based on the specified query conditions.
	List(ctx context.Context, templateCode string, opts ...meta.ListOption) (int64, []*model.TemplateM, error)
	// Get retrieves a user record by userID and username.
	Get(ctx context.Context, userID string, username string) (*model.TemplateM, error)
	// Update modifies an existing user record.
	Update(ctx context.Context, user *model.TemplateM) error
	// Delete removes a user record using the provided filters.
	Delete(ctx context.Context, filters map[string]any) error

	// Extensions
	// Fetch retrieves a user record using provided filters.
	Fetch(ctx context.Context, filters map[string]any) (*model.TemplateM, error)
	// GetByUsername retrieves a user record using username as the query condition.
	GetByUsername(ctx context.Context, username string) (*model.TemplateM, error)
}

TemplateStore defines the interface for managing user data storage.

Jump to

Keyboard shortcuts

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