store

package
v0.2.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package store defines the storage interface for fakeserver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetStore

func SetStore(store IStore)

SetStore set the onex-fakeserver store instance in a global variable `S`. Direct use the global `S` is not recommended as this may make dependencies and calls unclear.

Types

type IStore

type IStore interface {
	DB(ctx context.Context) *gorm.DB
	TX(ctx context.Context, fn func(ctx context.Context) error) error
	Orders() OrderStore
}

IStore defines the interface for the store layer, specifying the methods that need to be implemented.

var (

	// Global variable to hold the store instance
	S IStore
)

Singleton instance variables for the store.

type OrderExpansion

type OrderExpansion interface{}

OrderExpansion defines additional methods for order operations.

type OrderStore

type OrderStore interface {
	// Create adds a new order to the store.
	Create(ctx context.Context, order *model.OrderM) error

	// Update modifies an existing order in the store.
	Update(ctx context.Context, order *model.OrderM) error

	// Delete removes orders from the store based on the provided conditions.
	Delete(ctx context.Context, opts *where.Options) error

	// Get retrieves a single order from the store based on the provided conditions.
	Get(ctx context.Context, opts *where.Options) (*model.OrderM, error)

	// List retrieves a list of orders from the store based on the provided conditions.
	List(ctx context.Context, opts *where.Options) (int64, []*model.OrderM, error)

	OrderExpansion
}

OrderStore defines the interface for order-related operations.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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