Documentation
¶
Index ¶
- Variables
- type Artwork
- type ArtworkFilter
- type ArtworkSearchOptions
- type ArtworkSort
- type ArtworkStore
- type Bookmark
- type BookmarkFilter
- type BookmarkStore
- type Group
- type Guild
- type GuildRepost
- type GuildStore
- type Order
- type StatefulStore
- func (s *StatefulStore) AddArtChannels(ctx context.Context, guildID string, channels []string) (*Guild, error)
- func (s *StatefulStore) Artwork(ctx context.Context, id int, url string) (*Artwork, error)
- func (s *StatefulStore) CreateArtwork(ctx context.Context, a *Artwork) (*Artwork, error)
- func (s *StatefulStore) CreateGuild(ctx context.Context, guildID string) (*Guild, error)
- func (s *StatefulStore) DeleteArtChannels(ctx context.Context, guildID string, channels []string) (*Guild, error)
- func (s *StatefulStore) Guild(ctx context.Context, guildID string) (*Guild, error)
- func (s *StatefulStore) SearchArtworks(ctx context.Context, filter ArtworkFilter, opts ...ArtworkSearchOptions) ([]*Artwork, error)
- func (s *StatefulStore) UpdateGuild(ctx context.Context, guild *Guild) (*Guild, error)
- type Store
- type User
- type UserStore
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrArtworkNotFound = errors.New("artwork not found")
Functions ¶
This section is empty.
Types ¶
type Artwork ¶
type Artwork struct { ID int `json:"id" bson:"artwork_id"` Title string `json:"title" bson:"title"` Author string `json:"author" bson:"author"` URL string `json:"url" bson:"url"` Images []string `json:"images" bson:"images"` Favorites int `json:"favourites" bson:"favourites"` CreatedAt time.Time `json:"created_at" bson:"created_at"` UpdatedAt time.Time `json:"updated_at" bson:"updated_at"` }
type ArtworkFilter ¶
type ArtworkSearchOptions ¶
type ArtworkSearchOptions struct { Limit int64 Skip int64 Order Order Sort ArtworkSort }
func DefaultSearchOptions ¶
func DefaultSearchOptions() ArtworkSearchOptions
type ArtworkSort ¶
type ArtworkSort int
const ( ByTime ArtworkSort = iota ByPopularity )
func (ArtworkSort) String ¶
func (s ArtworkSort) String() string
type ArtworkStore ¶
type BookmarkFilter ¶
type BookmarkFilter int
const ( BookmarkFilterAll BookmarkFilter = iota BookmarkFilterSafe BookmarkFilterUnsafe )
type BookmarkStore ¶
type BookmarkStore interface { ListBookmarks(ctx context.Context, userID string, filter BookmarkFilter, order Order) ([]*Bookmark, error) CountBookmarks(ctx context.Context, userID string) (int64, error) AddBookmark(ctx context.Context, fav *Bookmark) (bool, error) DeleteBookmark(ctx context.Context, fav *Bookmark) (bool, error) }
type Guild ¶
type Guild struct { ID string `json:"id" bson:"guild_id" validate:"required"` Prefix string `json:"prefix" bson:"prefix" validate:"required,max=5"` Pixiv bool `json:"pixiv" bson:"pixiv"` Twitter bool `json:"twitter" bson:"twitter"` Deviant bool `json:"deviant" bson:"deviant"` Bluesky bool `json:"bluesky" bson:"bluesky"` Tags bool `json:"tags" bson:"tags"` FlavorText bool `json:"flavour_text" bson:"flavour_text"` Crosspost bool `json:"crosspost" bson:"crosspost"` Reactions bool `json:"reactions" bson:"reactions"` SkipFirst bool `json:"skip_first" bson:"skip_first"` Limit int `json:"limit" bson:"limit" validate:"required"` Repost GuildRepost `json:"repost" bson:"repost" validate:"required"` RepostExpiration time.Duration `json:"repost_expiration" bson:"repost_expiration"` ArtChannels []string `json:"art_channels" bson:"art_channels" validate:"required"` NSFW bool `json:"nsfw" bson:"nsfw"` CreatedAt time.Time `json:"created_at" bson:"created_at" validate:"required"` UpdatedAt time.Time `json:"updated_at" bson:"updated_at"` }
func DefaultGuild ¶
type GuildRepost ¶
type GuildRepost string
const ( GuildRepostEnabled GuildRepost = "enabled" GuildRepostDisabled GuildRepost = "disabled" GuildRepostStrict GuildRepost = "strict" )
type GuildStore ¶
type GuildStore interface { Guild(ctx context.Context, guildID string) (*Guild, error) CreateGuild(ctx context.Context, guildID string) (*Guild, error) UpdateGuild(ctx context.Context, guild *Guild) (*Guild, error) AddArtChannels(ctx context.Context, guildID string, channels []string) (*Guild, error) DeleteArtChannels(ctx context.Context, guildID string, channels []string) (*Guild, error) }
type StatefulStore ¶
type StatefulStore struct { Store // contains filtered or unexported fields }
func (*StatefulStore) AddArtChannels ¶
func (*StatefulStore) CreateArtwork ¶
func (*StatefulStore) CreateGuild ¶
func (*StatefulStore) DeleteArtChannels ¶
func (*StatefulStore) SearchArtworks ¶
func (s *StatefulStore) SearchArtworks(ctx context.Context, filter ArtworkFilter, opts ...ArtworkSearchOptions) ([]*Artwork, error)
func (*StatefulStore) UpdateGuild ¶
type Store ¶
type Store interface { ArtworkStore GuildStore UserStore BookmarkStore Init(context.Context) error Close(context.Context) error }
type User ¶
type User struct { ID string `json:"id" bson:"user_id"` DM bool `json:"dm" bson:"dm"` Crosspost bool `json:"crosspost" bson:"crosspost"` Ignore bool `json:"ignore" bson:"ignore"` Groups []*Group `json:"groups" bson:"channel_groups"` CreatedAt time.Time `json:"created_at" bson:"created_at"` UpdatedAt time.Time `json:"updated_at" bson:"updated_at"` }
func DefaultUser ¶
type UserStore ¶
type UserStore interface { CreateUser(ctx context.Context, userID string) (*User, error) UpdateUser(ctx context.Context, user *User) (*User, error) User(ctx context.Context, userID string) (*User, error) CreateCrosspostGroup(ctx context.Context, userID string, group *Group) (*User, error) CreateCrosspostPair(ctx context.Context, userID string, pair *Group) (*User, error) DeleteCrosspostGroup(ctx context.Context, userID string, group string) (*User, error) EditCrosspostParent(ctx context.Context, userID string, group string, parent string) (*User, error) RenameCrosspostGroup(ctx context.Context, userID string, name string, newName string) (*User, error) AddCrosspostChannel(ctx context.Context, userID string, group string, child string) (*User, error) DeleteCrosspostChannel(ctx context.Context, userID string, group string, child string) (*User, error) }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.