Documentation
¶
Index ¶
- Variables
- type Blogpost
- type DAO
- func (d *DAO) Backup()
- func (d *DAO) CreateEvent(ctx context.Context, event *Event) (*Event, error)
- func (d *DAO) DB() *gorm.DB
- func (d *DAO) GetEvent(ctx context.Context, id int) (*Event, error)
- func (d *DAO) GetSwitch(ctx context.Context, id string) (*Switch, error)
- func (d *DAO) HasBlogpost(ctx context.Context, postURL string) (bool, error)
- func (d *DAO) InsertBlogpost(ctx context.Context, post *jsonfeed.Item) (*Blogpost, error)
- func (d *DAO) ListSwitches(ctx context.Context, count, page int) ([]Switch, error)
- func (d *DAO) Members(ctx context.Context) ([]Member, error)
- func (d *DAO) Ping(ctx context.Context) error
- func (d *DAO) RemoveEvent(ctx context.Context, id int) error
- func (d *DAO) SwitchFront(ctx context.Context, memberName string) (*Switch, *Switch, error)
- func (d *DAO) UpcomingEvents(ctx context.Context, count int) ([]Event, error)
- func (d *DAO) WhoIsFront(ctx context.Context) (*Switch, error)
- type Event
- type Member
- type Switch
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrCantSwitchToYourself = errors.New("models: you can't switch to yourself")
)
Functions ¶
This section is empty.
Types ¶
type Blogpost ¶
type Blogpost struct { gorm.Model // adds CreatedAt, UpdatedAt, DeletedAt ID string `gorm:"uniqueIndex"` // unique identifier for the blogpost URL string `gorm:"uniqueIndex"` // URL of the blogpost Title string // title of the blogpost BodyHTML string // HTML body of the blogpost Image string // URL of the image for the blogpost PublishedAt time.Time // when the blogpost was published }
Blogpost is a single blogpost from a JSON Feed.
This is tracked in the database so that the Announcer service can avoid double-posting.
type DAO ¶
type DAO struct {
// contains filtered or unexported fields
}
func (*DAO) CreateEvent ¶
func (*DAO) HasBlogpost ¶
func (*DAO) InsertBlogpost ¶
func (*DAO) ListSwitches ¶
func (*DAO) RemoveEvent ¶ added in v1.11.0
func (*DAO) SwitchFront ¶
func (*DAO) UpcomingEvents ¶
type Event ¶
type Event struct { gorm.Model ID int `gorm:"primaryKey"` Name string URL string StartDate time.Time EndDate time.Time Location string `gorm:"index"` Description string Syndicate bool }
Event represents an event that members of DevRel will be attending.
type Member ¶
type Member struct { ID int // unique number to use as a primary key Name string `gorm:"uniqueIndex"` // the name of the member AvatarURL string // public URL to the member's avatar }
Member is a member of the Within system.
type Switch ¶
type Switch struct { gorm.Model // adds CreatedAt, UpdatedAt, DeletedAt ID string `gorm:"uniqueIndex"` // unique identifier for the switch (ULID usually) EndedAt *time.Time // when the switch ends, different from DeletedAt MemberID int // the member who is now in front Member Member `gorm:"foreignKey:MemberID"` }
Switch is a record of the system switching front to a different member.
func (Switch) AsFrontChange ¶
func (s Switch) AsFrontChange() *pb.FrontChange
AsFrontChange converts a Switch to a FrontChange protobuf.
Click to show internal directories.
Click to hide internal directories.