Skip to content

Latest commit

 

History

History
467 lines (301 loc) · 8.02 KB

File metadata and controls

467 lines (301 loc) · 8.02 KB
title Tables Reference
description Complete reference for all storage table types
author zoobzio
published 2025-01-01
updated 2025-01-06
tags
reference
tables
types

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 Types Storage Type
string string
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 Types Storage Type
int, int8, int16, int32, int64 int64
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 Types Storage Type
uint, uint8, uint16, uint32, uint64 uint64
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 Types Storage Type
float32, float64 float64
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 Types Storage Type
bool bool
Named bool types (type X bool) bool

Atom Field: Bools map[string]bool


TableTimes

const TableTimes Table = "times"

Stores time values.

Go Types Storage Type
time.Time time.Time

Atom Field: Times map[string]time.Time


TableBytes

const TableBytes Table = "bytes"

Stores byte slice values.

Go Types Storage 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: *string Atom Field: StringPtrs map[string]*string


TableIntPtrs

const TableIntPtrs Table = "int_ptrs"

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


TableUintPtrs

const TableUintPtrs Table = "uint_ptrs"

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


TableFloatPtrs

const TableFloatPtrs Table = "float_ptrs"

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


TableBoolPtrs

const TableBoolPtrs Table = "bool_ptrs"

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


TableTimePtrs

const TableTimePtrs Table = "time_ptrs"

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


TableBytePtrs

const TableBytePtrs Table = "byte_ptrs"

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


Slice Tables

Slice tables store arrays of values.

TableStringSlices

const TableStringSlices Table = "string_slices"

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


TableIntSlices

const TableIntSlices Table = "int_slices"

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


TableUintSlices

const TableUintSlices Table = "uint_slices"

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

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


TableFloatSlices

const TableFloatSlices Table = "float_slices"

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


TableBoolSlices

const TableBoolSlices Table = "bool_slices"

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


TableTimeSlices

const TableTimeSlices Table = "time_slices"

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


TableByteSlices

const TableByteSlices Table = "byte_slices"

Go Type: [][]byte Atom 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]string Atom 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]int64 Atom 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]uint64 Atom Field: UintMaps map[string]map[string]uint64


TableFloatMaps

const TableFloatMaps Table = "float_maps"

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


TableBoolMaps

const TableBoolMaps Table = "bool_maps"

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


TableTimeMaps

const TableTimeMaps Table = "time_maps"

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


TableByteMaps

const TableByteMaps Table = "byte_maps"

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


TableNestedMaps

const TableNestedMaps Table = "nested_maps"

Go Type: map[string]struct Atom 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:

Type Atom Field
struct Nested map[string]Atom
*struct Nested map[string]Atom (nil = no entry)
[]struct NestedSlices map[string][]Atom
[]*struct NestedSlices map[string][]Atom
map[string]struct NestedMaps 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

Category Tables
Scalar strings, ints, uints, floats, bools, times, bytes
Pointer *_ptrs variants
Slice *_slices variants
Map *_maps variants

By Storage Size

Size Tables
Variable strings, bytes, all slices
8 bytes ints, uints, floats, times
1 byte bools

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]