zoobzio January 5, 2025 Edit this page

Tables Reference

Complete reference for all storage tables.

Overview

Tables organize atomic values by type. Each table stores a specific category of values.

Scalar Tables

TableStrings

const TableStrings Table = "strings"

Stores string values.

Go TypesStorage Type
stringstring
Named string types (type X string)string

Atom Field: Strings map[string]string


TableInts

const TableInts Table = "ints"

Stores signed integer values (normalized to int64).

Go TypesStorage Type
int, int8, int16, int32, int64int64
Named int types (type X int)int64

Atom Field: Ints map[string]int64

Overflow: Values are validated during deatomization. Overflow returns an error.


TableUints

const TableUints Table = "uints"

Stores unsigned integer values (normalized to uint64).

Go TypesStorage Type
uint, uint8, uint16, uint32, uint64uint64
Named uint types (type X uint)uint64

Atom Field: Uints map[string]uint64


TableFloats

const TableFloats Table = "floats"

Stores floating-point values (normalized to float64).

Go TypesStorage Type
float32, float64float64
Named float types (type X float64)float64

Atom Field: Floats map[string]float64

Overflow: float32 overflow detected during deatomization.


TableBools

const TableBools Table = "bools"

Stores boolean values.

Go TypesStorage Type
boolbool
Named bool types (type X bool)bool

Atom Field: Bools map[string]bool


TableTimes

const TableTimes Table = "times"

Stores time values.

Go TypesStorage Type
time.Timetime.Time

Atom Field: Times map[string]time.Time


TableBytes

const TableBytes Table = "bytes"

Stores byte slice values.

Go TypesStorage Type
[]byte[]byte
[N]byte (fixed arrays)[]byte
Named byte slices (type X []byte, e.g., net.IP)[]byte

Atom Field: Bytes map[string][]byte

Note: Fixed arrays are validated for correct length during deatomization.


Pointer Tables

Pointer tables store optional values that can be nil.

TableStringPtrs

const TableStringPtrs Table = "string_ptrs"

Go Type: *stringAtom Field: StringPtrs map[string]*string


TableIntPtrs

const TableIntPtrs Table = "int_ptrs"

Go Types: *int, *int8, *int16, *int32, *int64Atom Field: IntPtrs map[string]*int64


TableUintPtrs

const TableUintPtrs Table = "uint_ptrs"

Go Types: *uint, *uint8, *uint16, *uint32, *uint64Atom Field: UintPtrs map[string]*uint64


TableFloatPtrs

const TableFloatPtrs Table = "float_ptrs"

Go Types: *float32, *float64Atom Field: FloatPtrs map[string]*float64


TableBoolPtrs

const TableBoolPtrs Table = "bool_ptrs"

Go Type: *boolAtom Field: BoolPtrs map[string]*bool


TableTimePtrs

const TableTimePtrs Table = "time_ptrs"

Go Type: *time.TimeAtom Field: TimePtrs map[string]*time.Time


TableBytePtrs

const TableBytePtrs Table = "byte_ptrs"

Go Type: *[]byteAtom Field: BytePtrs map[string]*[]byte


Slice Tables

Slice tables store arrays of values.

TableStringSlices

const TableStringSlices Table = "string_slices"

Go Type: []stringAtom Field: StringSlices map[string][]string


TableIntSlices

const TableIntSlices Table = "int_slices"

Go Types: []int, []int8, []int16, []int32, []int64Atom Field: IntSlices map[string][]int64


TableUintSlices

const TableUintSlices Table = "uint_slices"

Go Types: []uint, []uint8, []uint16, []uint32, []uint64Atom Field: UintSlices map[string][]uint64

Note: []byte is stored in TableBytes, not here.


TableFloatSlices

const TableFloatSlices Table = "float_slices"

Go Types: []float32, []float64Atom Field: FloatSlices map[string][]float64


TableBoolSlices

const TableBoolSlices Table = "bool_slices"

Go Type: []boolAtom Field: BoolSlices map[string][]bool


TableTimeSlices

const TableTimeSlices Table = "time_slices"

Go Type: []time.TimeAtom Field: TimeSlices map[string][]time.Time


TableByteSlices

const TableByteSlices Table = "byte_slices"

Go Type: [][]byteAtom Field: ByteSlices map[string][][]byte


Map Tables

Map tables store string-keyed maps of values.

TableStringMaps

const TableStringMaps Table = "string_maps"

Go Type: map[string]stringAtom Field: StringMaps map[string]map[string]string


TableIntMaps

const TableIntMaps Table = "int_maps"

Go Types: map[string]int, map[string]int8, map[string]int16, map[string]int32, map[string]int64Atom Field: IntMaps map[string]map[string]int64


TableUintMaps

const TableUintMaps Table = "uint_maps"

Go Types: map[string]uint, map[string]uint8, map[string]uint16, map[string]uint32, map[string]uint64Atom Field: UintMaps map[string]map[string]uint64


TableFloatMaps

const TableFloatMaps Table = "float_maps"

Go Types: map[string]float32, map[string]float64Atom Field: FloatMaps map[string]map[string]float64


TableBoolMaps

const TableBoolMaps Table = "bool_maps"

Go Type: map[string]boolAtom Field: BoolMaps map[string]map[string]bool


TableTimeMaps

const TableTimeMaps Table = "time_maps"

Go Type: map[string]time.TimeAtom Field: TimeMaps map[string]map[string]time.Time


TableByteMaps

const TableByteMaps Table = "byte_maps"

Go Type: map[string][]byteAtom Field: ByteMaps map[string]map[string][]byte


TableNestedMaps

const TableNestedMaps Table = "nested_maps"

Go Type: map[string]structAtom Field: NestedMaps map[string]map[string]Atom

Stores maps where values are structs, recursively atomized.


Nested Tables

Nested structs don't use a Table constant. They're stored in:

TypeAtom Field
structNested map[string]Atom
*structNested map[string]Atom (nil = no entry)
[]structNestedSlices map[string][]Atom
[]*structNestedSlices map[string][]Atom
map[string]structNestedMaps map[string]map[string]Atom

Table Methods

Prefix

func (t Table) Prefix() string

Returns string(t) + ":".

Useful for namespaced storage:

key := atom.TableStrings.Prefix() + "Name"
// "strings:Name"

Table Categories

Scalar vs Non-Scalar

CategoryTables
Scalarstrings, ints, uints, floats, bools, times, bytes
Pointer*_ptrs variants
Slice*_slices variants
Map*_maps variants

By Storage Size

SizeTables
Variablestrings, bytes, all slices
8 bytesints, uints, floats, times
1 bytebools

AllTables()

Returns all 29 tables in canonical order:

tables := atom.AllTables()
// [strings ints uints floats bools times bytes
//  byte_ptrs string_ptrs int_ptrs uint_ptrs float_ptrs bool_ptrs time_ptrs
//  string_slices int_slices uint_slices float_slices bool_slices time_slices byte_slices
//  string_maps int_maps uint_maps float_maps bool_maps time_maps byte_maps nested_maps]