Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

OGDL for Go

branch: master
README.md

OGDL for Go

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 languange 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

Discussion

Use the ogdl-go list, if necessary.

Example: a configuration file

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

eth0
  ip
    192.168.1.1
  gateway
    192.168.1.10
  mask
    255.255.255.0
  timeout
    20

then,

g := ogdl.ParseFile("conf.g")
ip,_ := g.GetString("eth0.ip")
to,_ := g.GetInt("eth0.timeout")
println("ip:",ip,", timeout:",to)

will print

ip: 192.168.1.1, timeout: 20
Something went wrong with that request. Please try again.