json

package
v0.14.8 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: MIT Imports: 21 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")

	TypeBlah = source.Type("blah")

	// 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