OGDL for Go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cmd lint Jul 11, 2018
ogdlrf lint Jul 11, 2018
.gitignore Initial commit Feb 21, 2013
LICENSE use subtests Jun 22, 2018
README.md change .g to .ogdl May 9, 2018
binary.go Refactoring, unstable! Feb 1, 2018
binary_test.go use subtests Jun 22, 2018
block.go add FromStringTypes, that converts OGDL to basic types Jun 22, 2018
doc.go change .g to .ogdl May 9, 2018
encoding.go lint Jul 11, 2018
eval.go use subtests Jun 22, 2018
eval_test.go use subtests Jun 22, 2018
event.go add FromStringTypes, that converts OGDL to basic types Jun 22, 2018
expression.go Refactoring, unstable! Feb 1, 2018
flow.go Some character classes made visible Feb 11, 2018
function.go lint Jul 11, 2018
gettypes.go Add default parameter option to Bool() Jun 22, 2018
graph.go New() now has exactly one (mandatory) argument May 10, 2018
graph_test.go use subtests Jun 22, 2018
lexer.go UnreadByte signature ? Jul 11, 2018
lexer_test.go Eval(): use _simplify in evalPath. For loop and indexes: remove root May 9, 2018
log.go Refactoring, unstable! Feb 1, 2018
parser.go add FromStringTypes, that converts OGDL to basic types Jun 22, 2018
parser_test.go use subtests Jun 22, 2018
path_test.go
schema.go Type should be ThisType to be consistent May 16, 2016
template.go
template_test.go use subtests Jun 22, 2018
vars.go clean up May 14, 2018

README.md

OGDL for Go

This library is being refactored. If you depend on the stable version, import gopkg.in/rveen/ogdl.v1 instead.

Package ogdl is used to process OGDL, the Ordered Graph Data Language.

OGDL is a textual format to write trees or graphs of text, where indentation and spaces define the structure. Here is an example:

network
  ip 192.168.1.100
  gw 192.168.1.9

The language is simple, either in its textual representation or its number of productions (the specification rules), allowing for compact implementations.

OGDL character streams are normally formed by Unicode characters, and encoded as UTF-8 strings, but any encoding that is ASCII transparent is compatible with the specification and the implementations.

This implementation does not support cyles (OGDL Level 2).

Documentation

The documentation of the package is kindly generated by godoc.org.

Installation

go get github.com/rveen/ogdl

go get gopkg.in/rveen/ogdl.v1  (for the previous -stable- version)

Discussion

There is a list: ogdl-go.

Example: a configuration file

If we have a text file 'conf.ogdl' like this:

eth0
  ip
    192.168.1.1
  gateway
    192.168.1.10
  mask
    255.255.255.0
  timeout
    20

then,

g := ogdl.FromFile("conf.ogdl")
ip := g.Get("eth0.ip").String()
to := g.Get("eth0.timeout").Int64(60)
println("ip:",ip,", timeout:",to)

will print

ip: 192.168.1.1, timeout: 20

If the timeout parameter were not present, then the default value (60) will be assigned to 'to'.