ucl

package module
v0.0.0-...-97c016f Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2015 License: BSD-2-Clause Imports: 8 Imported by: 29

README

ucl

UCL handling library in Go. See this page for info about UCL.

Known issues

This library is still work in progress and does not support any UCL features yet, only plain JSON.

Documentation

Overview

Package ucl implements parser and serializer for UCL (https://rspamd.com/doc/configuration/ucl.html). Currently it supports only plain JSON, but I'm working on that :)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(v Value, c *FormatConfig, w io.Writer) error

Format writes v, formatted according to c, to w.

Types

type Array

type Array struct {
	Value []Value
}

Array represents an array.

func (Array) String

func (v Array) String() string

type Bool

type Bool struct {
	Value bool
}

Bool represents boolean value.

func (Bool) String

func (v Bool) String() string

type FormatConfig

type FormatConfig struct {
	// Indent is a string to use for each indentation level. If not set defaults to 2 spaces.
	Indent string `json:",omitempty"`
	// MultilineObjectThreshold is the maximum length for an object to be written out on a single line.
	// Default is 0, meaning that any non-empty object will be written out with key-value pairs on separate lines.
	MultilineObjectThreshold int `json:",omitempty"`
	// MultilineObjectThreshold is the maximum length for an array to be written out on a single line.
	// Default is 0, meaning that any non-empty array will be written out with items on separate lines.
	MultilineArrayThreshold int `json:",omitempty"`
	// PreserveObjectKeysOrder must be set to true if you want to keep keys in the same order as in the input.
	// By default keys are sorted in lexicographical order.
	PreserveObjectKeysOrder bool `json:",omitempty"`
	// contains filtered or unexported fields
}

FormatConfig represents the formatter configuration that affects how data is layed out in the output file.

type Integer

type Integer struct {
	Value int64
}

Integer represents an integer numerical value.

func (Integer) String

func (v Integer) String() string

type Key

type Key struct {
	Value string
	Index int
}

Key represents keys in objects.

func (Key) String

func (v Key) String() string

type Null

type Null struct{}

Null represents "null" JSON value.

func (Null) String

func (Null) String() string

type Number

type Number struct {
	Value float64
}

Number represents a numerical value.

func (Number) String

func (v Number) String() string

type Object

type Object struct {
	Value map[Key]Value
}

Object represents an object.

func (Object) Find

func (v Object) Find(key string) Value

func (Object) Lookup

func (v Object) Lookup(key string) (Value, bool)

func (Object) String

func (v Object) String() string

type String

type String struct {
	Value string
}

String represents a string value.

func (String) String

func (v String) String() string

type Value

type Value interface {
	// String returns simple string representation of the value.
	String() string
	// contains filtered or unexported methods
}

Value represents a UCL value.

func Parse

func Parse(r io.Reader) (Value, error)

Parse reads UTF-8 text from r and parses it.

Directories

Path Synopsis
uclfmt is a utility for formatting UCL files.
uclfmt is a utility for formatting UCL files.

Jump to

Keyboard shortcuts

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