Documentation ¶
Index ¶
- Constants
- Variables
- type PgTicketConfigRepository
- func (r *PgTicketConfigRepository) Create(data TicketConfigCreateData) (*TicketConfig, error)
- func (r *PgTicketConfigRepository) CreateDefault(guildId string) (*TicketConfig, error)
- func (r *PgTicketConfigRepository) GetByGuildId(guildId string) (*TicketConfig, error)
- func (r *PgTicketConfigRepository) UpdateAllowMultiple(guildId string, allowMultiple bool) error
- func (r *PgTicketConfigRepository) UpdateChannelCategory(guildId string, channelCategoryId string) error
- func (r *PgTicketConfigRepository) UpdateChannelName(guildId string, channelName string) error
- func (r *PgTicketConfigRepository) UpdateEnabled(guildId string, enabled bool) error
- func (r *PgTicketConfigRepository) UpdateLogsChannel(guildId string, logsChannelId string) error
- type PgTicketRepository
- func (r *PgTicketRepository) Create(slug, channelId, userId, guildId string) (*Ticket, error)
- func (r *PgTicketRepository) DeleteByChannelId(channelId string) (*Ticket, error)
- func (r *PgTicketRepository) DeleteByMember(guildId, userId string) ([]Ticket, error)
- func (r *PgTicketRepository) DeleteBySlug(slug string) (*Ticket, error)
- func (r *PgTicketRepository) GenerateSlug() string
- func (r *PgTicketRepository) GetByChannelId(channelId string) (*Ticket, error)
- func (r *PgTicketRepository) GetByMember(guildId, userId string) ([]Ticket, error)
- func (r *PgTicketRepository) GetBySlug(slug string) (*Ticket, error)
- type Ticket
- type TicketConfig
- type TicketConfigCreateData
- type TicketConfigRepository
- type TicketRepository
Constants ¶
const ( DefaultConfigChannelName string = "ticket-{{USER}}-{{ID}}" DefaultConfigShortChannelName string = "t-{{USER}}-{{ID}}" DefaultConfigCategorizedChannelName string = "{{USER}}-{{ID}}" DefaultConfigEnabled bool = false DefaultConfigAllowMultiple bool = true TicketSlugLength int = 8 TicketSlugAlphabet string = "0123456789abcdefghijklmnopqrstuvwxyz" )
Variables ¶
var ( ErrInvalidChannelId = errors.Unexpected("ticket: channelId is not a valid int64") ErrInvalidUserId = errors.Unexpected("ticket: userId is not a valid int64") ErrInvalidGuildId = errors.Unexpected("ticket: guildId is not a valid int64") ErrInvalidSlug = errors.Unexpected("ticket: the slug is invalid") )
Functions ¶
This section is empty.
Types ¶
type PgTicketConfigRepository ¶
type PgTicketConfigRepository struct {
// contains filtered or unexported fields
}
func NewPgTicketConfigRepository ¶
func NewPgTicketConfigRepository(db *sql.DB) *PgTicketConfigRepository
func (*PgTicketConfigRepository) Create ¶
func (r *PgTicketConfigRepository) Create(data TicketConfigCreateData) (*TicketConfig, error)
Create implements TicketConfigRepository.
func (*PgTicketConfigRepository) CreateDefault ¶
func (r *PgTicketConfigRepository) CreateDefault(guildId string) (*TicketConfig, error)
CreateDefault implements TicketConfigRepository.
func (*PgTicketConfigRepository) GetByGuildId ¶
func (r *PgTicketConfigRepository) GetByGuildId(guildId string) (*TicketConfig, error)
GetByGuildId implements TicketConfigRepository.
func (*PgTicketConfigRepository) UpdateAllowMultiple ¶
func (r *PgTicketConfigRepository) UpdateAllowMultiple(guildId string, allowMultiple bool) error
UpdateAllowMultiple implements TicketConfigRepository.
func (*PgTicketConfigRepository) UpdateChannelCategory ¶
func (r *PgTicketConfigRepository) UpdateChannelCategory(guildId string, channelCategoryId string) error
UpdateChannelCategory implements TicketConfigRepository.
func (*PgTicketConfigRepository) UpdateChannelName ¶
func (r *PgTicketConfigRepository) UpdateChannelName(guildId string, channelName string) error
UpdateChannelName implements TicketConfigRepository.
func (*PgTicketConfigRepository) UpdateEnabled ¶
func (r *PgTicketConfigRepository) UpdateEnabled(guildId string, enabled bool) error
UpdateEnabled implements TicketConfigRepository.
func (*PgTicketConfigRepository) UpdateLogsChannel ¶
func (r *PgTicketConfigRepository) UpdateLogsChannel(guildId string, logsChannelId string) error
UpdateLogsChannel implements TicketConfigRepository.
type PgTicketRepository ¶
type PgTicketRepository struct {
// contains filtered or unexported fields
}
func NewPgTicketRepository ¶
func NewPgTicketRepository(db *sql.DB) *PgTicketRepository
func (*PgTicketRepository) Create ¶
func (r *PgTicketRepository) Create(slug, channelId, userId, guildId string) (*Ticket, error)
Create implements TicketRepository.
func (*PgTicketRepository) DeleteByChannelId ¶
func (r *PgTicketRepository) DeleteByChannelId(channelId string) (*Ticket, error)
DeleteByChannelId implements TicketRepository.
func (*PgTicketRepository) DeleteByMember ¶
func (r *PgTicketRepository) DeleteByMember(guildId, userId string) ([]Ticket, error)
DeleteByMember implements TicketRepository.
func (*PgTicketRepository) DeleteBySlug ¶
func (r *PgTicketRepository) DeleteBySlug(slug string) (*Ticket, error)
DeleteBySlug implements TicketRepository.
func (*PgTicketRepository) GenerateSlug ¶
func (r *PgTicketRepository) GenerateSlug() string
GenerateSlug implements TicketRepository.
func (*PgTicketRepository) GetByChannelId ¶
func (r *PgTicketRepository) GetByChannelId(channelId string) (*Ticket, error)
GetByChannelId implements TicketRepository.
func (*PgTicketRepository) GetByMember ¶
func (r *PgTicketRepository) GetByMember(guildId, userId string) ([]Ticket, error)
GetByMember implements TicketRepository.
type TicketConfig ¶
type TicketConfig struct { GuildId string CreatedAt time.Time UpdatedAt time.Time Enabled bool AllowMultiple bool // Nullable: coallessed to empty string // // The template to create the name of the ticket channel ChannelName string // Nullable: coallessed to empty string // // The discord channel category to put the ticket channels ChannelCategoryId string // Nullable: coallessed to empty string LogsChannelId string }
type TicketConfigCreateData ¶
type TicketConfigRepository ¶
type TicketConfigRepository interface { // The returned TicketConfig clould be nil GetByGuildId(guildId string) (*TicketConfig, error) // The returned TicketConfig must not be nil if err != nil Create(data TicketConfigCreateData) (*TicketConfig, error) // The returned TicketConfig must not be nil if err != nil CreateDefault(guildId string) (*TicketConfig, error) UpdateEnabled(guildId string, enabled bool) error UpdateAllowMultiple(guildId string, allowMultiple bool) error UpdateChannelName(guildId string, channelName string) error UpdateChannelCategory(guildId string, channelCategoryId string) error UpdateLogsChannel(guildId string, logsChannelId string) error }
type TicketRepository ¶
type TicketRepository interface { GenerateSlug() string // The returned Ticket clould be nil GetBySlug(slug string) (*Ticket, error) // The returned Ticket clould be nil GetByChannelId(channelId string) (*Ticket, error) // The returned Tickets clould be nil GetByMember(guildId, userId string) ([]Ticket, error) // The returned Ticket must not be nil if err != nil Create(slug, channelId, userId, guildId string) (*Ticket, error) // The returned ticket clould be nil DeleteBySlug(slug string) (*Ticket, error) // The returned Ticket clould be nil DeleteByChannelId(channelId string) (*Ticket, error) // The returned Tickets clould be nil DeleteByMember(guildId, userId string) ([]Ticket, error) }