gjson

package
v0.0.0-...-f3abbe6 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatIndent

func FormatIndent(p []byte) ([]byte, error)

func IsValid

func IsValid(json string) bool

func JSONDecode

func JSONDecode(data []byte, to interface{}) error

JSONDecode decodes JSON data into a structure

func JSONEncode

func JSONEncode(v interface{}) ([]byte, error)

JSONEncode encodes structure data into JSON

func Marshal

func Marshal(v interface{}, indent bool, errfmt string) []byte

func MarshalAndPrintln

func MarshalAndPrintln(x interface{})

func MarshalFast

func MarshalFast(v easyjson.Marshaler) ([]byte, error)

func MarshalIndent

func MarshalIndent(v interface{}) (string, error)

func MarshalString

func MarshalString(v interface{}, indent bool, errfmt string) string

func MarshalStringDefault

func MarshalStringDefault(v interface{}, indent bool) string

func Set

func Set(jsonstr string, path []string, val interface{}) (string, error)

Types

type Cell

type Cell struct {
	Data string
	// contains filtered or unexported fields
}

type Column

type Column struct {
	Cells []Cell
}

type JifTimestamp

type JifTimestamp time.Time

Json index friendly timestamp. Why choose format time as nanosecond int64, but not human readable string? time.RFC3339Nano is the only format which can format time with nanosecond accuracy, but it has timezone information in it, when you need create unique index for timestamp in json/jsonb database, same epoch timestamps in different timezone may be considered as different string/index.

func (JifTimestamp) MarshalJSON

func (t JifTimestamp) MarshalJSON() ([]byte, error)

type JsonValue

type JsonValue gjson.Result

func Get

func Get(json, path string) JsonValue

func (JsonValue) Bool

func (v JsonValue) Bool() bool

func (JsonValue) Exists

func (v JsonValue) Exists() bool

func (JsonValue) Float

func (v JsonValue) Float() float64

func (JsonValue) Int64

func (v JsonValue) Int64() int64

func (JsonValue) String

func (v JsonValue) String() string

func (JsonValue) Time

func (v JsonValue) Time() time.Time

type Row

type Row []string

type Table

type Table struct {
	Rows []Row
}

func NewTableFromExcel

func NewTableFromExcel(filename string) (*Table, error)

func NewTableFromString

func NewTableFromString(json string) (*Table, error)

func (*Table) AddColumn

func (d *Table) AddColumn(afterColumnIndex int, newColumn Column) error

func (*Table) AddRow

func (d *Table) AddRow(afterRowIndex int, newRow Row) error

func (*Table) GetColumn

func (d *Table) GetColumn(columnIndex int) (Column, error)

func (*Table) GetColumnsCount

func (d *Table) GetColumnsCount() (int, error)

func (*Table) GetRow

func (d *Table) GetRow(rowIndex int) (Row, error)

func (*Table) GetRowsCount

func (d *Table) GetRowsCount() (int, error)

func (*Table) RemoveColumn

func (d *Table) RemoveColumn(columnIndex int) error

Jump to

Keyboard shortcuts

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