JamesChung / omnistore

omnistore is designed to store anything and subsequently retrieve it.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

omnistore

omnistore is designed to store anything and subsequently retrieve it.

install

go get -u github.com/JamesChung/omnistore@latest

How to use

Set

omnistore.Set[string]("myname", "James")
omnistore.Set[float64]("pi", 3.14)

StringerSet

myString := MyEnum("examplestringerstring")
omnistore.StringerSet[MyEnum](myString, "myvalue")

myInt := MyEnum("examplestringerint")
omnistore.StringerSet[MyEnum](myInt, 42)

myFloat := MyEnum("examplestringerfloat")
omnistore.StringerSet[MyEnum](myFloat, 3.14)

Get

Get has a error returning equivalent called GetE

name := omnistore.Get[string]("myname")
// name == "James"

pi := omnistore.Get[float64]("pi")
// pi == 3.14

StringerGet

StringerGet has an error returning equivalent called StringerGetE

myString := MyEnum("examplestringerstring")
omnistore.StringerSet[MyEnum](myString, "myvalue")
fmt.Println(omnistore.StringerGet[MyEnum, string](myString))

myInt := MyEnum("examplestringerint")
omnistore.StringerSet[MyEnum](myInt, 42)
fmt.Println(omnistore.StringerGet[MyEnum, int](myInt))

myFloat := MyEnum("examplestringerfloat")
omnistore.StringerSet[MyEnum](myFloat, 3.14)
fmt.Println(omnistore.StringerGet[MyEnum, float64](myFloat))

About

omnistore is designed to store anything and subsequently retrieve it.

License:MIT License


Languages

Language:Go 100.0%