Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

storage.gno

0.38 Kb · 29 lines
 1package storage
 2
 3type Store map[string]string
 4
 5var store Store
 6
 7func init() {
 8	store = make(Store)
 9}
10
11func Set(key, value string) {
12	store[key] = value
13}
14
15func Get(key string) string {
16	return store[key]
17}
18
19func Delete(key string) {
20	delete(store, key)
21}
22
23func Render(_ string) string {
24	out := "storage:\n"
25	for k, v := range store {
26		out += "  " + k + " = " + v + "\n"
27	}
28	return out
29}