route/database/route.go

34 lines
681 B
Go

package database
import (
proto "git.xeserv.us/xena/route/proto"
"github.com/Xe/ln"
)
// Route is a single HTTP route.
type Route struct {
ID string `gorethink:"id,omitempty" storm:"id"`
Creator string
Hostname string `gorethink:"hostname" storm:"index"`
Token string `gorethink:"token" storm:"-"` // deprecated
}
// F https://godoc.org/github.com/Xe/ln#F
func (r Route) F() ln.F {
return ln.F{
"route-id": r.ID,
"route-creator": r.Creator,
"route-hostname": r.Hostname,
}
}
// AsProto converts this into the protobuf.
func (r Route) AsProto() *proto.Route {
return &proto.Route{
Id: r.ID,
Creator: r.Creator,
Host: r.Hostname,
}
}