Documentation
¶
Index ¶
- Variables
- func CleanTags(ctx context.Context, db bun.IDB) error
- func DeleteEvent(ctx context.Context, db *bun.DB, ev *domain.Event) error
- func DeleteExpiredInvites(ctx context.Context, db *bun.DB) error
- func DeleteInvite(ctx context.Context, db bun.IDB, token uuid.UUID) error
- func DeleteTags(ctx context.Context, db bun.IDB, eventID snowflake.ID) error
- func DeleteUser(ctx context.Context, db bun.IDB, id snowflake.ID) error
- func GetEvent(ctx context.Context, db *bun.DB, id snowflake.ID) (*domain.Event, error)
- func GetInvite(ctx context.Context, db *bun.DB, token uuid.UUID) (*domain.Invite, error)
- func GetSettings(ctx context.Context, db bun.IDB) (*domain.Settings, error)
- func GetUser(ctx context.Context, db bun.IDB, userID snowflake.ID) (*domain.User, error)
- func GetUserByUsername(ctx context.Context, db bun.IDB, username string) (*domain.User, error)
- func InsertEvent(ctx context.Context, db *bun.DB, ev *domain.Event) error
- func InsertInvite(ctx context.Context, db *bun.DB, invite *domain.Invite) error
- func InsertSettings(ctx context.Context, db bun.IDB, s *domain.Settings) error
- func InsertUser(ctx context.Context, db bun.IDB, user *domain.User) error
- func ListStopWords(ctx context.Context, db bun.IDB) ([]string, error)
- func ListTags(ctx context.Context, db bun.IDB, eventStartAtFrom, eventStartAtUntil time.Time, ...) ([]*domain.Tag, error)
- func ListUsers(ctx context.Context, db bun.IDB) ([]*domain.User, error)
- func SetStopWords(ctx context.Context, db bun.IDB, words domain.StopWordList) error
- func UpdateEvent(ctx context.Context, db *bun.DB, ev *domain.Event) error
- func UpdateSettings(ctx context.Context, db bun.IDB, s *domain.Settings) error
- func UpdateUser(ctx context.Context, db bun.IDB, user *domain.User) error
- type Event
- type EventOrder
- type EventsQueryBuilder
- func (build EventsQueryBuilder) List(ctx context.Context, db *bun.DB) ([]*domain.Event, error)
- func (build EventsQueryBuilder) WithIncludeDrafts() EventsQueryBuilder
- func (build EventsQueryBuilder) WithLimit(limit int) EventsQueryBuilder
- func (build EventsQueryBuilder) WithOrder(cursor int64, orders EventOrder) EventsQueryBuilder
- func (build EventsQueryBuilder) WithSearchText(s string) EventsQueryBuilder
- func (build EventsQueryBuilder) WithStartAtFrom(from time.Time) EventsQueryBuilder
- func (build EventsQueryBuilder) WithStartAtUntil(until time.Time) EventsQueryBuilder
- func (build EventsQueryBuilder) WithUserID(userID snowflake.ID) EventsQueryBuilder
- type Invite
- type SelectQuery
- type Settings
- type StopWord
- type Tag
- type User
Constants ¶
This section is empty.
Variables ¶
var ( OrderStartAtAsc = &[]string{"event.start_at_unix ASC", "event.id ASC"} OrderStartAtDesc = &[]string{"event.start_at_unix DESC", "event.id ASC"} OrderCreatedAtAsc = &[]string{"event.id ASC"} OrderCreatedAtDesc = &[]string{"event.id DESC"} )
Order values.
Functions ¶
func DeleteEvent ¶
DeleteEvent deletes an event..
func DeleteExpiredInvites ¶
DeleteExpiredInvites deletes expired invites.
func DeleteInvite ¶
DeleteInvite deletes an invite.
func DeleteTags ¶
DeleteTags deletes event's tags.
func DeleteUser ¶
DeleteUser deletes a user.
func GetSettings ¶
GetSettings returns settings.
func GetUserByUsername ¶
GetUserByUsername returns a user.
func InsertEvent ¶
InsertEvent inserts an event to the database.
func InsertInvite ¶
InsertInvite inserts a new event to the database.
func InsertSettings ¶
InsertSettings inserts settings.
func InsertUser ¶
InsertUser inserts a user into the database.
func ListStopWords ¶
ListStopWords lists all stopwords.
func ListTags ¶
func ListTags(ctx context.Context, db bun.IDB, eventStartAtFrom, eventStartAtUntil time.Time, userID snowflake.ID, limit int) ([]*domain.Tag, error)
ListTags lists most popular tags, excluding stopwords.
func SetStopWords ¶
SetStopWords sets stop words in the database.
func UpdateEvent ¶
UpdateEvent updates an event.
func UpdateSettings ¶
UpdateSettings updates settings.
Types ¶
type Event ¶
type Event struct {
ID snowflake.ID `bun:"id,pk"`
StartAtUnix int64 `bun:"start_at_unix"`
TimezoneOffset int `bun:"tz_offset"`
Title string `bun:"title"`
Description string `bun:"description"`
URL string `bun:"url"`
Location string `bun:"location"`
OSMType string `bun:"osm_type"`
OSMID uint64 `bun:"osm_id"`
Latitude float64 `bun:"latitude"`
Longitude float64 `bun:"longitude"`
IsDraft bool `bun:"is_draft"`
UserID snowflake.ID `bun:"user_id"`
bun.BaseModel `bun:"events"`
}
Event is the event database model.
type EventsQueryBuilder ¶
type EventsQueryBuilder func(*SelectQuery)
EventsQueryBuilder builds an event list query.
func NewEventsQuery ¶
func NewEventsQuery() EventsQueryBuilder
NewEventsQuery creates a new events list query. Note: cursor is ID cursor when sorting by created at and offset when sorting by start time.
func (EventsQueryBuilder) WithIncludeDrafts ¶
func (build EventsQueryBuilder) WithIncludeDrafts() EventsQueryBuilder
WithIncludeDrafts includes drafts.
func (EventsQueryBuilder) WithLimit ¶
func (build EventsQueryBuilder) WithLimit(limit int) EventsQueryBuilder
WithLimit configures results limit.
func (EventsQueryBuilder) WithOrder ¶
func (build EventsQueryBuilder) WithOrder(cursor int64, orders EventOrder) EventsQueryBuilder
WithOrder configures results order.
func (EventsQueryBuilder) WithSearchText ¶
func (build EventsQueryBuilder) WithSearchText(s string) EventsQueryBuilder
WithSearchText filters the result by search text.
func (EventsQueryBuilder) WithStartAtFrom ¶
func (build EventsQueryBuilder) WithStartAtFrom(from time.Time) EventsQueryBuilder
WithStartAtFrom configures minimum start at time.
func (EventsQueryBuilder) WithStartAtUntil ¶
func (build EventsQueryBuilder) WithStartAtUntil(until time.Time) EventsQueryBuilder
WithStartAtUntil configures maximum start at time.
func (EventsQueryBuilder) WithUserID ¶
func (build EventsQueryBuilder) WithUserID(userID snowflake.ID) EventsQueryBuilder
WithUserID filters the event list by user ID.
type Invite ¶
type Invite struct {
Token uuid.UUID `bun:"token"`
ValidUntilUnix int64 `bun:"valid_until_unix"`
CreatedBy snowflake.ID `bun:"created_by"`
bun.BaseModel `bun:"invites"`
}
Invite is the invite database model.
type SelectQuery ¶
type SelectQuery struct {
*bun.SelectQuery
// contains filtered or unexported fields
}
SelectQuery is an events select query.
type Settings ¶
type Settings struct {
ID int64 `bun:"id"`
Title string `bun:"title"`
Description string `bun:"description"`
bun.BaseModel `bun:"settings"`
}
Settings is the settings database model.
type StopWord ¶
type StopWord struct {
Word string `bun:"word,pk"`
Order uint64 `bun:"sort_order"`
bun.BaseModel `bun:"stopwords"`
}
StopWord is the stopword database model.