memcached

package
v0.0.0-...-ff2bd9c Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONJUNCTION = "."
)

Variables

This section is empty.

Functions

func AreStructsEqual

func AreStructsEqual(struct1, struct2 interface{}) bool

func CreateNewStructObject

func CreateNewStructObject(inputStruct interface{}) interface{}

CreateNewStructObject takes a struct pointer as a parameter and returns a new object of the same struct type.

func CreateStructPointerSlice

func CreateStructPointerSlice(inputStruct interface{}, numElements int) interface{}

CreateStructPointerSlice creates a slice of struct pointers with the same type as the input struct.

func DeleteCollection

func DeleteCollection(collection interface{}, data interface{}) ([]interface{}, error)

func GetPropertyNameToUpperCaseMapping

func GetPropertyNameToUpperCaseMapping(obj interface{}) (map[string]string, error)

GetPropertyNameToUpperCaseMapping returns a map of property names in upper case for the given struct.

func NewImmutableRepository

func NewImmutableRepository(client *redis.Client, key string, expirationDuration time.Duration, keyIdentifiers []*KeyIdentifier) repository.ImmutableGenericRepositoryInterface

func NewMutableRepository

func NewMutableRepository(client *redis.Client, key string, expirationDuration time.Duration, keyIdentifiers []*KeyIdentifier) repository.MutableGenericRepositoryInterface

func NewRepository

func NewRepository(client *redis.Client, key string, expirationDuration time.Duration, keyIdentifiers []*KeyIdentifier) repository.GenericRepositoryInterface

func UpdateCollection

func UpdateCollection(collection interface{}, data interface{}) ([]interface{}, error)

Types

type GenericRepository

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

func (*GenericRepository) BulkInsert

func (r *GenericRepository) BulkInsert(ctx context.Context, data interface{}) (interface{}, error)

BulkInsert for now just going to do bulkinsert for whole data

consideration - trade offs: + much faster - needs to implement sharding services for reading and writing to cutoff the data size as soon as possible

func (*GenericRepository) BulkUpsert

func (r *GenericRepository) BulkUpsert(ctx context.Context, data interface{}) (interface{}, error)

BulkUpsert for now just going to do bulkupsert for whole data by removing and reinsert new data

consideration - trade offs: + much faster - needs to implement sharding services for reading and writing to cutoff the data size as soon as possible

func (*GenericRepository) Delete

func (r *GenericRepository) Delete(ctx context.Context, data interface{}) (interface{}, error)

func (*GenericRepository) FindAll

func (r *GenericRepository) FindAll(ctx context.Context, params map[string]interface{}, conditionalOperations []repository.ConditionalOperation, relationalOperations []repository.RelationalOperation, page int, limit int, result interface{}) (interface{}, error)

FindAll to get all the data with filtered by parameters given (Not Recommended passing the params on memcached, the process might slowed down and take more memory since it is relying on reflect)

func (*GenericRepository) FindByID

func (r *GenericRepository) FindByID(ctx context.Context, id uuid.UUID, result interface{}) (interface{}, error)

func (*GenericRepository) FindOne

func (r *GenericRepository) FindOne(ctx context.Context, key string, value interface{}, result interface{}) (interface{}, error)

func (*GenericRepository) Insert

func (r *GenericRepository) Insert(ctx context.Context, data interface{}) (interface{}, error)

func (*GenericRepository) Query

func (r *GenericRepository) Query(ctx context.Context, query string, params []interface{}, result interface{}) (interface{}, error)

func (*GenericRepository) Update

func (r *GenericRepository) Update(ctx context.Context, data interface{}) (interface{}, error)

func (*GenericRepository) Upsert

func (r *GenericRepository) Upsert(ctx context.Context, data interface{}) (interface{}, error)

type KeyIdentifier

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

func NewKeyIdentifier

func NewKeyIdentifier(
	key string,
	isCollection bool,
	propertyNameMapToKey string,
) *KeyIdentifier

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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