2017-01-18 17:02:44 +00:00
|
|
|
package database
|
|
|
|
|
|
|
|
import (
|
2017-04-29 01:09:14 +00:00
|
|
|
proto "git.xeserv.us/xena/route/proto"
|
2017-04-29 02:47:24 +00:00
|
|
|
"github.com/Xe/ln"
|
2017-01-18 17:02:44 +00:00
|
|
|
)
|
|
|
|
|
2017-04-28 21:57:10 +00:00
|
|
|
// Route is a single HTTP route.
|
2017-01-18 17:02:44 +00:00
|
|
|
type Route struct {
|
2017-04-29 05:43:04 +00:00
|
|
|
ID string `storm:"id"`
|
2017-04-28 21:57:10 +00:00
|
|
|
Creator string
|
2017-04-29 06:04:22 +00:00
|
|
|
Hostname string `storm:"unique"`
|
2017-01-18 17:02:44 +00:00
|
|
|
}
|
|
|
|
|
2017-04-29 02:47:24 +00:00
|
|
|
// 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,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-29 01:09:14 +00:00
|
|
|
// AsProto converts this into the protobuf.
|
|
|
|
func (r Route) AsProto() *proto.Route {
|
|
|
|
return &proto.Route{
|
|
|
|
Id: r.ID,
|
|
|
|
Creator: r.Creator,
|
|
|
|
Host: r.Hostname,
|
2017-01-18 17:02:44 +00:00
|
|
|
}
|
|
|
|
}
|