1
0

more tests for good boy points, split entities into files

This commit is contained in:
2021-03-04 17:30:38 +01:00
parent f2347b8801
commit 13a990bb4a
6 changed files with 83 additions and 53 deletions

34
token.go Normal file
View File

@ -0,0 +1,34 @@
package main
import (
"fmt"
)
type Token struct {
Type string
Value string
}
func (t Token) String() string {
return fmt.Sprintf("%s : '%s'", t.Type, t.Value)
}
func Parse(t []Token) Feed {
var f Feed
for i := range t {
token := t[i]
if token.Type == "URL" {
f.URL = token.Value
}
if token.Type == "DESC" {
f.Description = token.Value
}
if token.Type == "TAG" {
f.Tags = append(f.Tags, token.Value)
}
}
return f
}