lite3

Lite3 zero-copy serialization format bindings for Kit

Files

FileDescription
kit.tomlPackage manifest with metadata and dependencies
src/lite3.kitKey-value store API and JSON conversion
zig/kit_ffi.zigCommon Kit FFI types and value helpers
zig/lite3.zigB-tree storage and JSON serialization
tests/test-lite3-ffi.kitFFI context creation and get/set operations
tests/test-lite3.kitLite3Value constructors and type predicates

Dependencies

No Kit package dependencies.

Installation

kit add gitlab.com/kit-lang/packages/kit-lite3.git

Usage

import Kit.Lite3

License

MIT License - see LICENSE for details.

Exported Functions & Types

Lite3Type

Lite3 value types

Variants

Lite3Null
null value
Lite3Bool
boolean value
Lite3Int
64-bit integer value
Lite3Float
64-bit floating point value
Lite3Bytes
byte array (list of bytes 0-255)
Lite3String
UTF-8 text string
Lite3Object
nested object
Lite3Array
nested array

Lite3Error

Lite3 error type for error handling.

match Lite3.get-str ctx "key"
  | Ok value -> println "Value: ${value}"
  | Err (Lite3Error { message }) -> println "Error: ${message}"

Variants

Lite3Error {message}

Lite3Handle

Opaque handle to a Lite3 context. This is an integer ID that references a context in the Zig registry.

Variants

Int

Lite3Value

Lite3 value - a Kit representation of data stored in Lite3 format.

This type is used for working with Lite3 data in a type-safe way.

Variants

Lite3ValueNull
Lite3ValueBool {Bool}
Lite3ValueInt {Int}
Lite3ValueFloat {Float}
Lite3ValueBytes {_0}
Lite3ValueString {String}
Lite3ValueObject {_0}
Lite3ValueArray {_0}

to-json-value

Converts a Lite3Value to a JSONValue.

Parameters:

Returns:

Lite3Value -> JSONValue

from-json-value

Converts a JSONValue to a Lite3Value.

Parameters:

Returns:

JSONValue -> Lite3Value

is-null?

Checks if value is null.

Lite3Value -> Bool

is-bool?

Checks if value is a boolean.

Lite3Value -> Bool

is-int?

Checks if value is an integer.

Lite3Value -> Bool

is-float?

Checks if value is a float.

Lite3Value -> Bool

is-bytes?

Checks if value is bytes.

Lite3Value -> Bool

is-string?

Checks if value is a string.

Lite3Value -> Bool

is-object?

Checks if value is an object.

Lite3Value -> Bool

is-array?

Checks if value is an array.

Lite3Value -> Bool

null

Creates a null value.

Lite3Value

bool

Creates a boolean value.

Bool -> Lite3Value

int

Creates an integer value.

Int -> Lite3Value

float

Creates a float value.

Float -> Lite3Value

bytes

Creates a bytes value.

[Int] -> Lite3Value

string

Creates a string value.

String -> Lite3Value

object

Creates an object value.

[(String, Lite3Value)] -> Lite3Value

array

Creates an array value.

[Lite3Value] -> Lite3Value