store

package module
v0.0.0-...-a499989 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 9 Imported by: 1

Documentation

Overview

Package store provides internal interfaces for dbServices and models to publish out changes

Package store provides a registry and interface to interact with a store repository against model entities.

Index

Constants

View Source
const (
	WebSocketStoreKey = "WebSocket"
	PathAdd           = "Add"
	PathRemove        = "Remove"
)

Variables

View Source
var OnChange func(key string, id string, path string, x interface{}, err error)

OnChange provides inserts, updates, and deletes to the store key.

View Source
var OnChangeRecord func(key string, id string, x interface{})
View Source
var OnRecordUpdate []string

OnRecordUpdate allows an application to publish all changes of a record

View Source
var Version string

Functions

func Add

func Add(key string, x interface{}, logger func(string, string)) (y interface{}, err error)

Add adds an entity to the collection and returns it.

func Append

func Append(key string, id string, path string, x interface{}, logger func(string, string)) (y interface{}, err error)

Append adds to an array field.

func Get

func Get(key string, id string, joins []string) (x interface{}, err error)

Get gets a collection entity by id.

func GetByFilter

func GetByFilter(key string, filter map[string]interface{}, inFilter map[string]interface{}, excludeFilter map[string]interface{}, joins []string) (x interface{}, err error)

GetByFilter gets a collection entity by filter.

func GetByPath

func GetByPath(key string, id string, joins []string, path string) (x interface{}, err error)

GetByPath gets a collection entity-property value by id & path.

func GetByPathBatch

func GetByPathBatch(key string, id string, joins []string, paths []string) (x interface{}, err error)

GetByPathBatch gets a collection entity-property values by id & path.

func GetCollection

func GetCollection(key string) (x collectionStore, ok bool)

GetCollection will return the collection by key string.

func GetCollectionHistory

func GetCollectionHistory(key string) (x collectionHistoryStore, ok bool)

GetCollection will return the collection by key string.

func GetCountByFilter

func GetCountByFilter(key string, filter map[string]interface{}, inFilter map[string]interface{}, excludeFilter map[string]interface{}, joins []string) (x interface{}, err error)

GetByFilter gets a collection entity by filter.

func Publish

func Publish(key string, id string, path string, logger func(string, string))

Publish fetches the record / path and publishes out to all subscribers.

func RegisterHistoryStore

func RegisterHistoryStore(x interface{})

RegisterStore will register a new store to the store registry.

func RegisterStore

func RegisterStore(x interface{})

RegisterStore will register a new store to the store registry.

func Remove

func Remove(key string, id string) (err error)

Remove removes an entity from the collection and returns the Id Removed.

func Set

func Set(key string, id string, path string, x interface{}, logger func(string, string)) (err error)

Set updates a collection by id, path.

func Splice

func Splice(key string, id string, path string, x interface{}, logger func(string, string)) (y interface{}, err error)

Splice removes to an array field.

Types

This section is empty.

Jump to

Keyboard shortcuts

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