json

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package json implements the sq driver for JSON. There are three supported types: - JSON: plain old JSON - JSONA: JSON Array, where each record is an array of JSON values on its own line. - JSONL: JSON Lines, where each record a JSON object on its own line.

Index

Constants

View Source
const (
	// TypeJSON is the plain-old JSON driver type.
	TypeJSON = source.Type("json")

	// TypeJSONA is the JSON Array driver type.
	TypeJSONA = source.Type("jsona")

	// TypeJSONL is the JSON Lines driver type.
	TypeJSONL = source.Type("jsonl")
)

Variables

This section is empty.

Functions

func DetectJSON

func DetectJSON(ctx context.Context, log lg.Log, openFn source.FileOpenFunc) (detected source.Type, score float32,
	err error,
)

DetectJSON implements source.TypeDetectFunc. The function returns TypeJSON for two varieties of input:.

func DetectJSONA

func DetectJSONA(ctx context.Context, log lg.Log, openFn source.FileOpenFunc) (detected source.Type, score float32,
	err error,
)

DetectJSONA implements source.TypeDetectFunc for TypeJSONA. Each line of input must be a valid JSON array.

func DetectJSONL

func DetectJSONL(ctx context.Context, log lg.Log, openFn source.FileOpenFunc) (detected source.Type, score float32,
	err error,
)

DetectJSONL implements source.TypeDetectFunc.

Types

type Provider

type Provider struct {
	Log       lg.Log
	Scratcher driver.ScratchDatabaseOpener
	Files     *source.Files
}

Provider implements driver.Provider.

func (*Provider) DriverFor

func (d *Provider) DriverFor(typ source.Type) (driver.Driver, error)

DriverFor implements driver.Provider.

Jump to

Keyboard shortcuts

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