Add more documentation

This commit is contained in:
Miek Gieben 2012-05-03 09:05:30 +02:00
parent 901be67f92
commit 52d391e251
1 changed files with 11 additions and 0 deletions

View File

@ -115,6 +115,17 @@ func ReadRR(q io.Reader, filename string) (RR, error) {
// in error reporting. The string origin is used as the initial origin, as
// if the file would start with: $ORIGIN origin .
// The channel t is closed by ParseZone when the end of r is reached.
//
// Basic usage pattern when reading from a string (z) containing the
// zone data:
//
// to := ParseZone(strings.NewReader(z), "", "testzone")
// for x := range to {
// if x.Error != nil {
// // Do something with x.RR
// }
// }
//
func ParseZone(r io.Reader, origin, file string) chan Token {
t := make(chan Token)
go parseZone(r, origin, file, t, 0)