store

package
v0.0.0-...-9e9d5e8 Latest Latest
Warning

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

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

Documentation

Overview

Package store provides methods for interacting with a thread safe global store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(key string, value Value)

Delete will take the key and values which needs to be deleted from the global store and delete that entry

func Initialize

func Initialize()

Initialize initializes the global store

It will skip initialization if the store has already been initialized once

func Set

func Set(key string, value Value)

Set will set the key value pairs in the global store

If the key already exists but the data has changed then it will also be added to the list. It computes md5 hash of the data to check if the data already exists

Types

type Value

type Value interface {
	SetID(id string)
	GetID() string
}

Value is an interface that all the values MUST satisfy which can be stored in the key value pair store

func GetAll

func GetAll(key string) []Value

GetAll returns all the values stored against the key

func GetByID

func GetByID(id string) (Value, bool)

GetByID takes in an id and returns the result that matches that ID

func PrefixMatch

func PrefixMatch(key string) (res []Value)

PrefixMatch will return all the values which matches the given key

Jump to

Keyboard shortcuts

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