Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder reads and decodes twtxt values from an input stream.
For example:
var decoder twtxt.Decoder
err := decoder.SetReader(reader)
if nil != err {
return err
}
defer decoder.Close()
for decoder.Next() {
kind := decoder.Kind()
switch kind {
case twtxt.KindStatus:
var when time.Time
var content string
err := decoder.Decode(&when, &content)
if nil != err {
return err
}
//@TODO
case twtxt.KindComment:
var comment string
err := decoder.Decode(&comment)
if nil != err {
return err
}
//@TODO
case twtxt.KindInvalid:
var invalid string
err := decoder.Decode(&invalid)
if nil != err {
return err
}
//@TODO
default:
//@TODO
}
}
if err := decoder.Err(); nil != err {
return err
}
func (*Decoder) Decode ¶
Decode decodes the next twtxt line.
You should call Kind() before calling Decode() to know what type and how many parameters to pass it.
Click to show internal directories.
Click to hide internal directories.