exporter

package
v0.44.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package exporter exposes stable result export helpers backed by tinySQL's internal exporter implementation.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportCSV

func ExportCSV(w io.Writer, rs *tinysql.ResultSet, opts Options) error

ExportCSV writes ResultSet rows as CSV to w.

func ExportGOB

func ExportGOB(w io.Writer, rs *tinysql.ResultSet) error

ExportGOB writes ResultSet rows and column order as a GOB payload.

func ExportGeoJSON added in v0.27.0

func ExportGeoJSON(w io.Writer, rs *tinysql.ResultSet, geomCol string, opts Options) error

ExportGeoJSON writes ResultSet rows as an RFC 7946 GeoJSON FeatureCollection. geomCol names the geometry column; pass "" to auto-detect it.

func ExportJSON

func ExportJSON(w io.Writer, rs *tinysql.ResultSet, opts Options) error

ExportJSON writes ResultSet rows as a JSON array of objects.

Example
package main

import (
	"bytes"
	"fmt"

	tinysql "github.com/SimonWaldherr/tinySQL"
	"github.com/SimonWaldherr/tinySQL/exporter"
)

// jsonExampleResult gives the example a named package-level fixture while
// keeping the usage of ExportJSON concise.
var jsonExampleResult = &tinysql.ResultSet{
	Cols: []string{"id", "name"},
	Rows: []tinysql.Row{{"id": 1, "name": "Ada"}},
}

func main() {
	var out bytes.Buffer
	if err := exporter.ExportJSON(&out, jsonExampleResult, exporter.Options{}); err != nil {
		panic(err)
	}
	fmt.Print(out.String())

}
Output:
[{"id":1,"name":"Ada"}]

func ExportNDJSON added in v0.19.0

func ExportNDJSON(w io.Writer, rs *tinysql.ResultSet, opts Options) error

ExportNDJSON streams one JSON object per ResultSet row to w.

func ExportSQL added in v0.14.0

func ExportSQL(w io.Writer, rs *tinysql.ResultSet, tableName string) error

ExportSQL writes ResultSet rows as INSERT statements for tableName.

func ExportTSV

func ExportTSV(w io.Writer, rs *tinysql.ResultSet, opts Options) error

ExportTSV writes ResultSet rows as tab-separated values to w.

func ExportTableManifest added in v0.19.0

func ExportTableManifest(w io.Writer, db *tinysql.DB, tenant, tableName string) error

ExportTableManifest writes a versioned table schema and data fingerprint.

func ExportTopoJSON added in v0.27.0

func ExportTopoJSON(w io.Writer, rs *tinysql.ResultSet, geomCol, objectName string, opts Options) error

ExportTopoJSON writes ResultSet rows as a TopoJSON v3 Topology. geomCol names the geometry column (pass "" to auto-detect it); objectName names the single "objects" key (pass "" for the default, "collection").

func ExportXLSX added in v0.27.0

func ExportXLSX(w io.Writer, rs *tinysql.ResultSet, opts Options) error

ExportXLSX writes ResultSet rows as a single-sheet Excel workbook to w.

func ExportXML

func ExportXML(w io.Writer, rs *tinysql.ResultSet) error

ExportXML writes ResultSet rows as simple XML.

Types

type ManifestColumn added in v0.19.0

type ManifestColumn = ie.ManifestColumn

ManifestColumn describes one column in a TableManifest.

type Options

type Options = ie.Options

Options controls exporter behavior.

type TableManifest added in v0.19.0

type TableManifest = ie.TableManifest

TableManifest is the portable table schema and data-fingerprint document.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL