Documentation ¶
Index ¶
- func AddAnnouncement(a *Announcement) (err error)
- func AddComment(c *Comment) (err error)
- func AddModeration(a *Moderation) (err error)
- func AddTicket(t *Ticket) (err error)
- func DelAnnouncement(id int64) (err error)
- func DelTicket(id int64) (err error)
- func DeleteComment(id int64) (err error)
- func HasTicketWithCategory(c string) bool
- func SetupEngine() *xorm.Engine
- func UpdateAnnouncement(a *Announcement) (err error)
- func UpdateAnnouncementCols(a *Announcement, cols ...string) error
- func UpdateComment(c *Comment) (err error)
- func UpdateTicket(t *Ticket) (err error)
- func UpdateTicketCols(t *Ticket, cols ...string) error
- type Announcement
- type Comment
- type HotTickets
- type Moderation
- type ModerationSort
- type Ticket
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAnnouncement ¶
func AddAnnouncement(a *Announcement) (err error)
AddAnnouncement inserts a new announcement into the database
func AddComment ¶
AddComment adds a new Comment to the database.
func AddModeration ¶
func AddModeration(a *Moderation) (err error)
AddModeration inserts a new moderations into the database
func DelAnnouncement ¶
DelAnnouncement deletes a announcement based on the AnnouncementID
func DeleteComment ¶
DeleteComment deletes a comment from the database.
func HasTicketWithCategory ¶
func SetupEngine ¶
SetupEngine sets up an XORM engine according to the database configuration and syncs the schema.
func UpdateAnnouncement ¶
func UpdateAnnouncement(a *Announcement) (err error)
UpdateAnnouncement updates an announcement in the database.
func UpdateAnnouncementCols ¶
func UpdateAnnouncementCols(a *Announcement, cols ...string) error
UpdateAnnouncementCols updates an announcement in the database including the specified columns, even if the fields are empty.
func UpdateComment ¶
UpdateComment updates a comment in the database.
func UpdateTicket ¶
UpdateTicket updates a comment in the database.
func UpdateTicketCols ¶
UpdateTicketCols updates a ticket in the database including the specified columns, even if the fields are empty.
Types ¶
type Announcement ¶
type Announcement struct { AnnouncementID int64 `xorm:"pk autoincr"` Summary string `xorm:"-"` Title string `xorm:"text"` Tags string `xorm:"text"` CreatedUnix int64 `xorm:"created"` UpdatedUnix int64 `xorm:"updated"` Description string `xorm:"text"` }
Announcement represents an announcement
func GetAnnouncement ¶
func GetAnnouncement(id int64) (*Announcement, error)
GetAnnouncement fetches an announcement based on the AnnouncementID
func GetAnnouncements ¶
func GetAnnouncements() (announcements []Announcement)
GetAnnouncements fetches all announcement in the database
type Comment ¶
type Comment struct { CommentID int64 `xorm:"pk autoincr"` TicketID int64 `xorm:"notnull"` PosterID string `xorm:"notnull"` IsAdmin bool Text string `xorm:"notnull"` FormattedText template.HTML `xorm:"-" json:"-"` CreatedUnix int64 `xorm:"created"` UpdatedUnix int64 `xorm:"updated"` }
Comment represents an anonymous comment to a ticket.
func GetComment ¶
GetComment gets a comment based on the ID. It will return the pointer to the Comment, and whether there was an error.
type HotTickets ¶
type HotTickets []Ticket
HotTicket implements sort.Interface for []Ticket based on iota score diminished by time.
func (HotTickets) Len ¶
func (p HotTickets) Len() int
func (HotTickets) Less ¶
func (p HotTickets) Less(i, j int) bool
func (HotTickets) Swap ¶
func (p HotTickets) Swap(i, j int)
type Moderation ¶
type Moderation struct { ModerationID int64 `xorm:"pk autoincr"` CreatedUnix int64 `xorm:"created"` UpdatedUnix int64 `xorm:"updated"` Admin string Title string `xorm:"text"` Description string `xorm:"text"` DescriptionSensitive bool Reason string `xorm:"text"` }
Moderation represents an moderations
func GetModeration ¶
func GetModeration(id int64) (*Moderation, error)
GetModeration fetches an announcement based on the ModerationID
func GetModerations ¶
func GetModerations() (moderations []Moderation)
GetModerations fetches all moderations in the database
type ModerationSort ¶
type ModerationSort []Moderation
ModerationSort implements sort.Interface for []Moderation depending on date.
func (ModerationSort) Len ¶
func (p ModerationSort) Len() int
func (ModerationSort) Less ¶
func (p ModerationSort) Less(i, j int) bool
func (ModerationSort) Swap ¶
func (p ModerationSort) Swap(i, j int)
type Ticket ¶
type Ticket struct { TicketID int64 `xorm:"pk autoincr"` Title string `xorm:"text"` Category string `xorm:"text"` CreatedUnix int64 `xorm:"created"` UpdatedUnix int64 `xorm:"updated"` Description string `xorm:"text"` Voters []string IsRep bool `xorm:"bool"` // Used for adding badge to emphasise rep tickets IsResolved bool CommentsCount int `xorm:"-"` Comments []Comment `xorm:"-"` }
Ticket represents an issue
func GetCategory ¶
GetCategory creates a new array of type Ticket and populates it with tickets of a certain category
func GetTickets ¶
func GetTickets() (tickets []Ticket)
GetTickets fetches all tickets in the database
func (*Ticket) LoadComments ¶
LoadComments loads the comments of the ticket into a non-mapped field.