gura #
V Gura
vlang.io | Docs | Changelog | Contributing
>>> import gura { raw_parse, raw_encode }
>>> data := raw_parse('text: "Hello World!"') ?
>>> println(data)
{'text': gura.Any('Hello World!')}
>>> raw_encode(data)
text: "Hello World!"
Installation
Via vpm
$ v install gura
Via vpkg
$ vpkg get https://github.com/gura-conf/vgura
Done. Installation completed.
Testing
To test the module, just type the following command:
$ ./bin/test # execute `./bin/test -h` to know more about the test command
License
Contributors
Made with contributors-img.
Constants #
const (
	null = Null{}
)const (
	version = '0.1.10'
)fn encode #
fn encode[T](typ T) stringencode is a generic function that encodes a type into a gura string.
fn parse #
fn parse[T](src string) ?Tparse is a generic function that parses a gura string into the target type.
fn raw_encode #
fn raw_encode(data map[string]Any) stringraw_encode generates a Gura string from a dictionary
fn raw_parse #
fn raw_parse(text string) ?map[string]Anyraw_parse parses a text in Gura format
interface Serializable #
interface Serializable {
	from_gura(f map[string]Any)
	to_gura() map[string]Any
}fn ([]Any) as_strings #
fn (a []Any) as_strings() []stringtype Any #
type Any = Null
	| []Any
	| bool
	| f32
	| f64
	| i16
	| i64
	| i8
	| int
	| map[string]Any
	| string
	| u16
	| u32
	| u64
	| u8Any is a sum type that lists the possible types to be decoded and used.
fn (Any) to_json #
fn (a Any) to_json() stringto_json returns Any as a JSON encoded string.
fn (Any) str #
fn (f Any) str() stringstr returns the string representation of the Any type.
fn (Any) as_map #
fn (f Any) as_map() map[string]Anyas_map uses Any as a map.
fn (Any) string #
fn (a Any) string() stringstring returns Any as a string.
fn (Any) int #
fn (f Any) int() intint uses Any as an integer.
fn (Any) i64 #
fn (f Any) i64() i64i64 uses Any as a 64-bit integer.
fn (Any) u64 #
fn (f Any) u64() u64u64 uses Any as a 64-bit unsigned integer.
fn (Any) f32 #
fn (f Any) f32() f32f32 uses Any as a 32-bit float.
fn (Any) f64 #
fn (f Any) f64() f64f64 uses Any as a float.
fn (Any) arr #
fn (f Any) arr() []Anyarr uses Any as an array.
fn (Any) bool #
fn (f Any) bool() boolbool uses Any as a bool
fn (map[string]Any) value #
fn (m map[string]Any) value(key string) ?Anyfn (map[string]Any) to_json #
fn (a map[string]Any) to_json() stringto_json returns Any as a JSON encoded string.
struct DuplicatedImportError #
struct DuplicatedImportError {
	Error
pub:
	msg string
}fn (DuplicatedImportError) msg #
fn (err &DuplicatedImportError) msg() stringstruct DuplicatedVariableError #
struct DuplicatedVariableError {
	Error
pub:
	msg string
}fn (DuplicatedVariableError) msg #
fn (err &DuplicatedVariableError) msg() stringstruct FileNotFoundError #
struct FileNotFoundError {
	Error
pub:
	msg string
}fn (FileNotFoundError) msg #
fn (err &FileNotFoundError) msg() stringstruct InvalidIndentationError #
struct InvalidIndentationError {
	Error
pub:
	msg string
}fn (InvalidIndentationError) msg #
fn (err &InvalidIndentationError) msg() stringstruct Null #
struct Null {}Null struct is a simple representation of the null value in GURA.
fn (Null) str #
fn (_ Null) str() stringstruct ParseError #
struct ParseError {
	Error
pub:
	msg  string
	line int
	pos  int
}fn (ParseError) msg #
fn (err &ParseError) msg() stringstruct VariableNotDefinedError #
struct VariableNotDefinedError {
	Error
pub:
	key string
	msg string
}fn (VariableNotDefinedError) msg #
fn (err &VariableNotDefinedError) msg() string- README
- Constants
- fn encode        
- fn parse        
- fn raw_encode        
- fn raw_parse        
- interface Serializable        
- type []Any
- type Any
- type map[string]Any
- struct DuplicatedImportError
- struct DuplicatedVariableError
- struct FileNotFoundError
- struct InvalidIndentationError
- struct Null
- struct ParseError
- struct VariableNotDefinedError