Documentation ¶
Overview ¶
Package gparser provides convenient API for accessing/converting variable and JSON/XML/YAML/TOML.
Index ¶
- func MustToIni(value interface{}) []byte
- func MustToIniString(value interface{}) string
- func MustToJson(value interface{}) []byte
- func MustToJsonIndent(value interface{}) []byte
- func MustToJsonIndentString(value interface{}) string
- func MustToJsonString(value interface{}) string
- func MustToToml(value interface{}) []byte
- func MustToTomlString(value interface{}) string
- func MustToXml(value interface{}, rootTag ...string) []byte
- func MustToXmlIndent(value interface{}, rootTag ...string) []byte
- func MustToXmlIndentString(value interface{}, rootTag ...string) string
- func MustToXmlString(value interface{}, rootTag ...string) string
- func MustToYaml(value interface{}) []byte
- func MustToYamlString(value interface{}) string
- func VarToIni(value interface{}) ([]byte, error)
- func VarToIniString(value interface{}) (string, error)
- func VarToJson(value interface{}) ([]byte, error)
- func VarToJsonIndent(value interface{}) ([]byte, error)
- func VarToJsonIndentString(value interface{}) (string, error)
- func VarToJsonString(value interface{}) (string, error)
- func VarToToml(value interface{}) ([]byte, error)
- func VarToTomlString(value interface{}) (string, error)
- func VarToXml(value interface{}, rootTag ...string) ([]byte, error)
- func VarToXmlIndent(value interface{}, rootTag ...string) ([]byte, error)
- func VarToXmlIndentString(value interface{}, rootTag ...string) (string, error)
- func VarToXmlString(value interface{}, rootTag ...string) (string, error)
- func VarToYaml(value interface{}) ([]byte, error)
- func VarToYamlString(value interface{}) (string, error)
- type Parser
- func Load(path string, safe ...bool) (*Parser, error)
- func LoadContent(data interface{}, safe ...bool) (*Parser, error)
- func LoadIni(data interface{}, safe ...bool) (*Parser, error)
- func LoadJson(data interface{}, safe ...bool) (*Parser, error)
- func LoadToml(data interface{}, safe ...bool) (*Parser, error)
- func LoadXml(data interface{}, safe ...bool) (*Parser, error)
- func LoadYaml(data interface{}, safe ...bool) (*Parser, error)
- func New(data interface{}, safe ...bool) *Parser
- func NewWithTag(data interface{}, tags string, safe ...bool) *Parser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustToIniString ¶ added in v1.10.1
func MustToIniString(value interface{}) string
func MustToJson ¶ added in v1.10.1
func MustToJson(value interface{}) []byte
func MustToJsonIndent ¶ added in v1.10.1
func MustToJsonIndent(value interface{}) []byte
func MustToJsonIndentString ¶ added in v1.10.1
func MustToJsonIndentString(value interface{}) string
func MustToJsonString ¶ added in v1.10.1
func MustToJsonString(value interface{}) string
func MustToToml ¶ added in v1.10.1
func MustToToml(value interface{}) []byte
func MustToTomlString ¶ added in v1.10.1
func MustToTomlString(value interface{}) string
func MustToXmlIndent ¶ added in v1.10.1
func MustToXmlIndentString ¶ added in v1.10.1
func MustToXmlString ¶ added in v1.10.1
func MustToYaml ¶ added in v1.10.1
func MustToYaml(value interface{}) []byte
func MustToYamlString ¶ added in v1.10.1
func MustToYamlString(value interface{}) string
func VarToIniString ¶ added in v1.10.1
func VarToJsonIndent ¶
func VarToJsonIndentString ¶
func VarToJsonString ¶
func VarToTomlString ¶ added in v1.10.1
func VarToXmlIndent ¶
func VarToXmlIndentString ¶ added in v1.10.1
func VarToXmlString ¶ added in v1.10.1
func VarToYamlString ¶ added in v1.10.1
Types ¶
type Parser ¶
Parser is actually alias of gjson.Json.
func Load ¶
Load loads content from specified file <path>, and creates a Parser object from its content.
func LoadContent ¶
LoadContent creates a Parser object from given content, it checks the data type of <content> automatically, supporting JSON, XML, INI, YAML and TOML types of data.
func New ¶
New creates a Parser object with any variable type of <data>, but <data> should be a map, struct or slice for data access reason, or it will make no sense.
The parameter <safe> specifies whether using this Json object in concurrent-safe context, which is false in default.
func NewWithTag ¶ added in v1.11.5
NewWithTag creates a Parser object with any variable type of <data>, but <data> should be a map or slice for data access reason, or it will make no sense.
The parameter <tags> specifies priority tags for struct conversion to map, multiple tags joined with char ','.
The parameter <safe> specifies whether using this Json object in concurrent-safe context, which is false in default.