API Reference

Complete API documentation for Tauq across all supported languages.

🐍 Python API

Installation

pip install tauq

tauq.loads(s: str) -> Any

Parse a Tauq string and return the corresponding Python object.

import tauq

data = tauq.loads("""
!def User id name email
1 Alice alice@example.com
2 Bob bob@example.com
""")
# Returns: [{'id': 1, 'name': 'Alice', 'email': 'alice@example.com'}, ...]

tauq.load(path: str) -> Any

Load and parse a Tauq file.

config = tauq.load('config.tqn')
print(config['server']['port'])

tauq.dumps(obj: Any, schema: str = None) -> str

Serialize a Python object to a Tauq string.

users = [
    {'id': 1, 'name': 'Alice', 'email': 'alice@example.com'},
    {'id': 2, 'name': 'Bob', 'email': 'bob@example.com'},
]
tauq_str = tauq.dumps(users)
# Output:
# !def Record id name email
# 1 Alice alice@example.com
# 2 Bob bob@example.com

tauq.stream(file) -> Iterator[dict]

Stream records from a Tauq file without loading everything into memory.

with open('large_file.tqn') as f:
    for record in tauq.stream(f):
        process(record)

🦀 Rust API

Installation

cargo add tauq

tauq::from_str<T>(s: &str) -> Result<T>

Parse a Tauq string into a typed value.

use serde::Deserialize;

#[derive(Deserialize)]
struct Config {
    server: Server,
    database: Database,
}

let config: Config = tauq::from_str(tauq_string)?;

tauq::from_file<T>(path: &str) -> Result<T>

Load and parse a Tauq file into a typed value.

let config: Config = tauq::from_file("config.tqn")?;

tauq::to_string<T>(value: &T) -> Result<String>

Serialize a value to a Tauq string.

use serde::Serialize;

#[derive(Serialize)]
struct User {
    id: u64,
    name: String,
    email: String,
}

let users = vec![
    User { id: 1, name: "Alice".into(), email: "alice@example.com".into() },
];
let tauq_str = tauq::to_string(&users)?;

tauq::StreamReader

Stream records from a Tauq source.

use tauq::StreamReader;
use std::fs::File;

let file = File::open("large_file.tqn")?;
let reader = StreamReader::new(file);

for record in reader {
    let record = record?;
    process(record);
}

📜 JavaScript API

Installation

npm install tauq

parse(str: string): any

Parse a Tauq string and return the corresponding JavaScript object.

import { parse } from 'tauq';

const data = parse(`
!def User id name email
1 Alice alice@example.com
2 Bob bob@example.com
`);
// Returns: [{ id: 1, name: 'Alice', email: 'alice@example.com' }, ...]

load(path: string): Promise<any>

Load and parse a Tauq file (Node.js).

import { load } from 'tauq';

const config = await load('config.tqn');
console.log(config.server.port);

stringify(obj: any): string

Serialize a JavaScript object to a Tauq string.

import { stringify } from 'tauq';

const users = [
  { id: 1, name: 'Alice', email: 'alice@example.com' },
  { id: 2, name: 'Bob', email: 'bob@example.com' },
];
const tauqStr = stringify(users);

🐹 Go API

Installation

go get github.com/epistates/tauq

tauq.Unmarshal(data []byte, v any) error

Parse Tauq data into a Go struct.

package main

import "github.com/epistates/tauq"

type Config struct {
    Server struct {
        Host string `tauq:"host"`
        Port int    `tauq:"port"`
    } `tauq:"server"`
}

func main() {
    var config Config
    err := tauq.Unmarshal(data, &config)
}

tauq.Marshal(v any) ([]byte, error)

Serialize a Go value to Tauq format.

users := []User{
    {ID: 1, Name: "Alice", Email: "alice@example.com"},
    {ID: 2, Name: "Bob", Email: "bob@example.com"},
}
data, err := tauq.Marshal(users)

CLI Reference

Looking for command-line tool documentation?

View CLI Reference