data

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRecordNotFound      = errors.New("record not found")
	ErrRecordAlreadyExists = errors.New("record already exists")
)

Functions

func PSQLGeneratedInsert

func PSQLGeneratedInsert(model interface{}) string

Function to generate an SQLX insert statement with placeholders i.e for query INSERT INTO table (column1, column2...) VALUES (:column1, :column2...) Will check if default field value is not nil/empty before adding to query

func PSQLGeneratedUpdate

func PSQLGeneratedUpdate(model interface{}) string

func RemoveSliceItem

func RemoveSliceItem[T any](slice []T, index int) []T

Idk where tf to put this thing so its getting thrown in here for now

func SqlGenKeys

func SqlGenKeys(model interface{}) string

Helper to automatically generate the PSQL query for the keys of a struct

Types

type Ability

type Ability struct {
	ID          int64          `db:"id" json:"id"`
	Name        string         `db:"name" json:"name"`
	Description string         `db:"description" json:"description"`
	Categories  pq.StringArray `db:"categories" json:"categories"`
	Charges     int            `db:"charges" json:"charges"`
	AnyAbility  bool           `db:"any_ability" json:"any_ability"`
	Rarity      string         `db:"rarity" json:"rarity"`
	CreatedAt   string         `db:"created_at" json:"created_at"`
}

Ability that is role specific.

type AbilityModel

type AbilityModel struct {
	DB *sqlx.DB
}

func (*AbilityModel) Delete

func (am *AbilityModel) Delete(id int64) error

func (*AbilityModel) Get

func (am *AbilityModel) Get(id int64) (*Ability, error)

func (*AbilityModel) GetAll

func (am *AbilityModel) GetAll() ([]Ability, error)

func (*AbilityModel) GetAllAnyAbilities

func (am *AbilityModel) GetAllAnyAbilities() ([]AnyAbility, error)

func (*AbilityModel) GetAnyAbility

func (am *AbilityModel) GetAnyAbility(id int64) (*AnyAbility, error)

func (*AbilityModel) GetAnyAbilityByCategory

func (am *AbilityModel) GetAnyAbilityByCategory(category string) ([]AnyAbility, error)

func (*AbilityModel) GetAnyAbilityByName

func (am *AbilityModel) GetAnyAbilityByName(name string) (*AnyAbility, error)

func (*AbilityModel) GetAnyAbilityByRarity

func (am *AbilityModel) GetAnyAbilityByRarity(rarity string) ([]AnyAbility, error)

func (*AbilityModel) GetAnyAbilitybyFuzzy

func (am *AbilityModel) GetAnyAbilitybyFuzzy(name string) (*AnyAbility, error)

func (*AbilityModel) GetByCategory

func (am *AbilityModel) GetByCategory(category string) ([]Ability, error)

func (*AbilityModel) GetByFuzzy

func (am *AbilityModel) GetByFuzzy(name string) (*Ability, error)

func (*AbilityModel) GetByName

func (am *AbilityModel) GetByName(name string) (*Ability, error)

func (*AbilityModel) GetByRarity

func (am *AbilityModel) GetByRarity(rarity string) ([]Ability, error)

func (*AbilityModel) GetRandomAnyAbilityByRarity

func (am *AbilityModel) GetRandomAnyAbilityByRarity(rarity string) (*AnyAbility, error)

func (*AbilityModel) GetRandomByRarity

func (am *AbilityModel) GetRandomByRarity(rarity string) (*Ability, error)

func (*AbilityModel) Insert

func (am *AbilityModel) Insert(a *Ability) (int64, error)

func (*AbilityModel) InsertAnyAbility

func (am *AbilityModel) InsertAnyAbility(aa *AnyAbility) error

func (*AbilityModel) Update

func (am *AbilityModel) Update(a *Ability) error

func (*AbilityModel) UpdateAnyAbility

func (am *AbilityModel) UpdateAnyAbility(aa *AnyAbility) error

func (*AbilityModel) Upsert

func (am *AbilityModel) Upsert(a *Ability) error

func (*AbilityModel) WipeTable

func (am *AbilityModel) WipeTable() error

type Action

type Action struct {
	ID                 int64  `db:"id" json:"id"`
	RequestedAction    string `db:"requested_action" json:"requested_action"`
	RequestedChannelID string `db:"requested_channel_id" json:"requested_channel_id"`
	RequestedMessageID string `db:"requested_message_id" json:"requested_message_id"`
	RequesterID        string `db:"requester_id" json:"requester_id"`
	RequestedAt        string `db:"requested_at" json:"requested_at"`
	RequestedDay       int64  `db:"requested_day" json:"requested_day"`
}

type ActionModel

type ActionModel struct {
	DB *sqlx.DB
}

func (*ActionModel) Get

func (am *ActionModel) Get(id int64) (*Action, error)

func (*ActionModel) Insert

func (am *ActionModel) Insert(action *Action) (int64, error)

func (*ActionModel) Update

func (am *ActionModel) Update(action *Action) error

type Alliance

type Alliance struct {
	ID        int            `db:"id" json:"id"`
	Name      string         `db:"name" json:"name"`
	ChannelID string         `db:"channel_id" json:"channel_id"`
	MemberIDs pq.StringArray `db:"member_ids" json:"member_ids"`
}

type AllianceInvite

type AllianceInvite struct {
	ID              int    `db:"id" json:"id"`
	InviterID       string `db:"inviter_id" json:"inviter_id"`
	InviteeID       string `db:"invitee_id" json:"invitee_id"`
	AllianceName    string `db:"alliance_name" json:"alliance_name"`
	InviteeAccepted bool   `db:"invitee_accepted" json:"invitee_accepted"`
}

type AllianceModel

type AllianceModel struct {
	DB *sqlx.DB
}

func (*AllianceModel) Delete

func (am *AllianceModel) Delete(alliance *Alliance) error

Delete any associated invites and requests with the alliance

func (*AllianceModel) DeleteInvite

func (am *AllianceModel) DeleteInvite(invite *AllianceInvite) error

func (AllianceModel) DeleteInviteByInviteeIDAndInviterID

func (am AllianceModel) DeleteInviteByInviteeIDAndInviterID(inviteeID, inviterID string) error

func (*AllianceModel) DeleteRequest

func (am *AllianceModel) DeleteRequest(req *AllianceRequest) error

func (*AllianceModel) DeleteRequestByName

func (ah *AllianceModel) DeleteRequestByName(name string) error

func (*AllianceModel) GetAllByMemberID

func (am *AllianceModel) GetAllByMemberID(discordID string) ([]Alliance, error)

func (*AllianceModel) GetAllInvites

func (am *AllianceModel) GetAllInvites() ([]AllianceInvite, error)

func (*AllianceModel) GetAllInvitesForUser

func (am *AllianceModel) GetAllInvitesForUser(userID string) ([]AllianceInvite, error)

func (*AllianceModel) GetAllRequests

func (am *AllianceModel) GetAllRequests() ([]AllianceRequest, error)

func (*AllianceModel) GetAlliances

func (am *AllianceModel) GetAlliances() ([]Alliance, error)

func (*AllianceModel) GetByMemberID

func (am *AllianceModel) GetByMemberID(discordID string) (*Alliance, error)

func (*AllianceModel) GetByName

func (am *AllianceModel) GetByName(name string) (*Alliance, error)

func (*AllianceModel) GetInviteByInviteeIDAndAllianceName

func (am *AllianceModel) GetInviteByInviteeIDAndAllianceName(inviteeID, allianceName string) (*AllianceInvite, error)

func (*AllianceModel) GetInviteByInviteeIDAndInviterID

func (am *AllianceModel) GetInviteByInviteeIDAndInviterID(inviteeID, inviterID string) (*AllianceInvite, error)

func (*AllianceModel) GetInvitesByAllianceName

func (am *AllianceModel) GetInvitesByAllianceName(allianceName string) ([]AllianceInvite, error)

func (*AllianceModel) GetRequestByName

func (am *AllianceModel) GetRequestByName(name string) (*AllianceRequest, error)

func (*AllianceModel) GetRequestByRequesterID

func (am *AllianceModel) GetRequestByRequesterID(name string) (*AllianceRequest, error)

func (*AllianceModel) Insert

func (am *AllianceModel) Insert(alliance *Alliance) error

func (*AllianceModel) InsertInvite

func (am *AllianceModel) InsertInvite(invite *AllianceInvite) error

func (*AllianceModel) InsertMember

func (am *AllianceModel) InsertMember(alliance *Alliance) error

func (*AllianceModel) InsertRequest

func (am *AllianceModel) InsertRequest(req *AllianceRequest) error

func (*AllianceModel) UpdateAllianceMembers

func (am *AllianceModel) UpdateAllianceMembers(alliance *Alliance) error

func (*AllianceModel) UpdateInviteInviteeAccepted

func (am *AllianceModel) UpdateInviteInviteeAccepted(invite *AllianceInvite) error

type AllianceRequest

type AllianceRequest struct {
	ID          int    `db:"id" json:"id"`
	RequesterID string `db:"requester_id" json:"requester_id"`
	Name        string `db:"name" json:"name"`
}

type AnyAbility

type AnyAbility struct {
	ID          int64          `db:"id" json:"id"`
	Name        string         `db:"name" json:"name"`
	Description string         `db:"description" json:"description"`
	Categories  pq.StringArray `db:"categories" json:"categories"`
	Rarity      string         `db:"rarity" json:"rarity"`
	// Name of the role that this ability is specific to. If empty, it is not specific to any role.
	RoleSpecific string `db:"role_specific"`
}

Ability that can be rolled in AA events

type FunnelChannel

type FunnelChannel struct {
	ID         int64  `db:"id" json:"id"`
	ChannelID  string `db:"channel_id" json:"channel_id"`
	GuildID    string `db:"guild_id" json:"guild_id"`
	CurrentDay int    `db:"current_day" json:"current_day"`
}

type FunnelChannelModel

type FunnelChannelModel struct {
	DB *sqlx.DB
}

func (*FunnelChannelModel) Get

func (fcm *FunnelChannelModel) Get(guildID string) (*FunnelChannel, error)

func (*FunnelChannelModel) Insert

func (fcm *FunnelChannelModel) Insert(funnelChannel *FunnelChannel) (int64, error)

func (*FunnelChannelModel) Remove

func (fcm *FunnelChannelModel) Remove(guildID string) error

type Hitlist

type Hitlist struct {
	ID         int64  `db:"id" json:"id"`
	PinChannel string `db:"pin_channel" json:"pin_channel"`
	PinMessage string `db:"pin_message" json:"pin_message"`
}

type HitlistModel

type HitlistModel struct {
	DB *sqlx.DB
}

func (*HitlistModel) Delete

func (hl *HitlistModel) Delete(id int64) error

func (*HitlistModel) Get

func (hl *HitlistModel) Get() (*Hitlist, error)

func (*HitlistModel) Upsert

func (hl *HitlistModel) Upsert(h *Hitlist) (int64, error)

Inserts hitlist entry and removes any existing hitlist entry

type Insult

type Insult struct {
	Id        int64  `db:"id" json:"id"`
	Insult    string `db:"insult" json:"insult"`
	AuthorID  string `db:"author_id" json:"author_id"`
	CreatedAt string `db:"created_at" json:"created_at"`
}

type InsultModel

type InsultModel struct {
	DB *sqlx.DB
}

func (*InsultModel) DeleteInsult

func (im *InsultModel) DeleteInsult(i *Insult) error

func (*InsultModel) GetRandom

func (im *InsultModel) GetRandom() (*Insult, error)

func (*InsultModel) Insert

func (im *InsultModel) Insert(i *Insult) error

type Inventory

type Inventory struct {
	ID             int64          `db:"id" json:"id"`
	DiscordID      string         `db:"discord_id" json:"discord_id"`
	UserPinChannel string         `db:"user_pin_channel" json:"user_pin_channel"`
	UserPinMessage string         `db:"user_pin_message" json:"user_pin_message"`
	RoleName       string         `db:"role_name" json:"role_name"`
	Alignment      string         `db:"alignment" json:"alignment"`
	Abilities      pq.StringArray `db:"abilities" json:"abilities"`
	AnyAbilities   pq.StringArray `db:"any_abilities" json:"any_abilities"`
	Statuses       pq.StringArray `db:"statuses" json:"statuses"`
	Immunities     pq.StringArray `db:"immunities" json:"immunities"`
	Effects        pq.StringArray `db:"effects" json:"effects"`
	Items          pq.StringArray `db:"items" json:"items"`
	ItemLimit      int            `db:"item_limit" json:"item_limit"`
	Perks          pq.StringArray `db:"perks" json:"perks"`
	IsAlive        bool           `db:"is_alive" json:"is_alive"`
	Coins          int64          `db:"coins" json:"coins"`
	CoinBonus      float32        `db:"coin_bonus" json:"coin_bonus"`
	Luck           int64          `db:"luck" json:"luck"`
	Notes          pq.StringArray `db:"notes" json:"notes"`
	CreatedAt      string         `db:"created_at" json:"created_at"`
}

type InventoryCronJob

type InventoryCronJob struct {
	ID int `db:"id"`
	// foreign key to Inventory ID
	InventoryID int64  `db:"inventory_id" json:"inventory_id"`
	ChannelID   string `db:"channel_id" json:"channel_id"`
	PlayerID    string `db:"player_id" json:"player_id"`
	Category    string `db:"category" json:"category"`
	ActionType  string `db:"action_type" json:"action_type"`
	Value       string `db:"value" json:"value"`
	StartTime   int64  `db:"start_time" json:"start_time"`
	InvokeTime  int64  `db:"invoke_time" json:"invoke_time"`
}

Metadata is a struct that contains all the metadata for a cron job

func (*InventoryCronJob) MakeJobID

func (icj *InventoryCronJob) MakeJobID() string

MakeJobID returns a unique job ID for the cron job based on the inventory ID, category, action type, and value

type InventoryCronJobModel

type InventoryCronJobModel struct {
	DB *sqlx.DB
}

func (*InventoryCronJobModel) DeleteByID

func (icjm *InventoryCronJobModel) DeleteByID(id int) error

func (*InventoryCronJobModel) DeleteByInventoryID

func (icjm *InventoryCronJobModel) DeleteByInventoryID(inventoryID string) error

func (*InventoryCronJobModel) DeletebyJobID

func (icjm *InventoryCronJobModel) DeletebyJobID(jobID string) error

func (*InventoryCronJobModel) ExtendInvokeTime

func (icjm *InventoryCronJobModel) ExtendInvokeTime(time int64) error

func (*InventoryCronJobModel) GetAll

func (cjm *InventoryCronJobModel) GetAll() (*InventoryCronJob, error)

func (*InventoryCronJobModel) GetByCategory

func (cjm *InventoryCronJobModel) GetByCategory(category string) ([]InventoryCronJob, error)

func (*InventoryCronJobModel) GetByInventoryID

func (icjm *InventoryCronJobModel) GetByInventoryID(inventoryID string) ([]InventoryCronJob, error)

func (*InventoryCronJobModel) GetByJobID

func (icjm *InventoryCronJobModel) GetByJobID(jobID string) (*InventoryCronJob, error)

func (*InventoryCronJobModel) Insert

func (icjm *InventoryCronJobModel) Insert(icj *InventoryCronJob) error

func (*InventoryCronJobModel) Upsert

func (icjm *InventoryCronJobModel) Upsert(icj *InventoryCronJob) error

Upsert will insert or update the cron job based on the job ID

type InventoryModel

type InventoryModel struct {
	DB *sqlx.DB
}

func (*InventoryModel) Delete

func (m *InventoryModel) Delete(discordID string) error

func (*InventoryModel) GetAll

func (m *InventoryModel) GetAll() ([]Inventory, error)

func (*InventoryModel) GetAllActiveRoleNames

func (m *InventoryModel) GetAllActiveRoleNames() ([]string, error)

func (*InventoryModel) GetAllPlayerIDs

func (m *InventoryModel) GetAllPlayerIDs() ([]string, error)

func (*InventoryModel) GetByDiscordID

func (m *InventoryModel) GetByDiscordID(discordID string) (*Inventory, error)

func (*InventoryModel) GetByPinChannel

func (m *InventoryModel) GetByPinChannel(pinChannel string) (*Inventory, error)

func (*InventoryModel) Insert

func (m *InventoryModel) Insert(i *Inventory) (int64, error)

func (*InventoryModel) Update

func (m *InventoryModel) Update(inventory *Inventory) error

func (*InventoryModel) UpdateAbilities

func (m *InventoryModel) UpdateAbilities(inventory *Inventory) error

func (*InventoryModel) UpdateAnyAbilities

func (m *InventoryModel) UpdateAnyAbilities(inventory *Inventory) error

Overwrites the entire abilities column with the new abilities

func (*InventoryModel) UpdateCoinBonus

func (m *InventoryModel) UpdateCoinBonus(inventory *Inventory) error

func (*InventoryModel) UpdateCoins

func (m *InventoryModel) UpdateCoins(inventory *Inventory) error

func (*InventoryModel) UpdateEffects

func (m *InventoryModel) UpdateEffects(inventory *Inventory) error

func (*InventoryModel) UpdateImmunities

func (m *InventoryModel) UpdateImmunities(inventory *Inventory) error

func (*InventoryModel) UpdateItemLimit

func (m *InventoryModel) UpdateItemLimit(inventory *Inventory) error

func (*InventoryModel) UpdateItems

func (m *InventoryModel) UpdateItems(inventory *Inventory) error

func (*InventoryModel) UpdateLuck

func (m *InventoryModel) UpdateLuck(inventory *Inventory) error

func (*InventoryModel) UpdateNotes

func (m *InventoryModel) UpdateNotes(inventory *Inventory) error

func (*InventoryModel) UpdatePerks

func (m *InventoryModel) UpdatePerks(inventory *Inventory) error

func (*InventoryModel) UpdateProperty

func (m *InventoryModel) UpdateProperty(
	inventory *Inventory,
	columnName string,
	value interface{},
) error

func (*InventoryModel) UpdateStatuses

func (m *InventoryModel) UpdateStatuses(inventory *Inventory) error

type Item

type Item struct {
	ID          int64          `db:"id" json:"id"`
	Name        string         `db:"name" json:"name"`
	Description string         `db:"description" json:"description"`
	Cost        int64          `db:"cost" json:"cost"`
	Rarity      string         `db:"rarity" json:"rarity"`
	Categories  pq.StringArray `db:"categories" json:"categories"`
	CreatedAt   string         `db:"created_at" json:"created_at"`
}

type ItemModel

type ItemModel struct {
	DB *sqlx.DB
}

func (*ItemModel) Delete

func (im *ItemModel) Delete(id int64) error

func (*ItemModel) Get

func (im *ItemModel) Get(id int64) (*Item, error)

func (*ItemModel) GetAll

func (im *ItemModel) GetAll() ([]Item, error)

func (*ItemModel) GetByFuzzy

func (im *ItemModel) GetByFuzzy(name string) (*Item, error)

func (*ItemModel) GetByName

func (im *ItemModel) GetByName(name string) (*Item, error)

func (*ItemModel) GetByRarity

func (im *ItemModel) GetByRarity(rarity string) ([]Item, error)

func (*ItemModel) GetRandomByRarity

func (im *ItemModel) GetRandomByRarity(rarity string) (*Item, error)

func (*ItemModel) Insert

func (im *ItemModel) Insert(i *Item) (int64, error)

func (*ItemModel) Update

func (im *ItemModel) Update(item *Item) error

type Models

type Models struct {
	Roles             RoleModel
	Insults           InsultModel
	Abilities         AbilityModel
	Perks             PerkModel
	Statuses          StatusModel
	Items             ItemModel
	Inventories       InventoryModel
	Whitelists        WhitelistModel
	Actions           ActionModel
	FunnelChannels    FunnelChannelModel
	Votes             VoteModel
	RoleLists         RoleListModel
	Hitlists          HitlistModel
	Alliances         AllianceModel
	InventoryCronJobs InventoryCronJobModel
}

All interested models to be used in the application

func NewModels

func NewModels(db *sqlx.DB) Models

NewModels creates a new instance of the Models struct and attaches the database connection to it.

type Perk

type Perk struct {
	ID          int64  `db:"id" json:"id"`
	Name        string `db:"name" json:"name"`
	Description string `db:"description" json:"description"`
	CreatedAt   string `db:"created_at" json:"created_at"`
}

type PerkModel

type PerkModel struct {
	DB *sqlx.DB
}

func (*PerkModel) Delete

func (pm *PerkModel) Delete(id int64) error

func (*PerkModel) Get

func (pm *PerkModel) Get(id int64) (*Perk, error)

func (*PerkModel) GetAll

func (pm *PerkModel) GetAll() ([]Perk, error)

func (*PerkModel) GetByFuzzy

func (pm *PerkModel) GetByFuzzy(name string) (*Perk, error)

func (*PerkModel) GetByName

func (pm *PerkModel) GetByName(name string) (*Perk, error)

func (*PerkModel) Insert

func (pm *PerkModel) Insert(p *Perk) (int64, error)

func (*PerkModel) Update

func (pm *PerkModel) Update(p *Perk) error

func (*PerkModel) UpdateName

func (p *PerkModel) UpdateName(perk *Perk) error

func (*PerkModel) Upsert

func (pm *PerkModel) Upsert(p *Perk) error

type Role

type Role struct {
	ID          int64  `db:"id" json:"id"`
	Name        string `db:"name" json:"name"`
	Description string `db:"description" json:"description"`
	Alignment   string `db:"alignment" json:"alignment"`
	CreatedAt   string `db:"created_at" json:"created_at"`
}

How roles are stored in the database.

type RoleList

type RoleList struct {
	ID    int            `db:"id" json:"id"`
	Roles pq.StringArray `db:"roles" json:"roles"`
}

type RoleListModel

type RoleListModel struct {
	DB *sqlx.DB
}

func (*RoleListModel) Delete

func (r *RoleListModel) Delete(roleList RoleList) error

func (*RoleListModel) Get

func (r *RoleListModel) Get() (*RoleList, error)

func (*RoleListModel) Insert

func (r *RoleListModel) Insert(roleList RoleList) error

func (*RoleListModel) Update

func (r *RoleListModel) Update(roleList RoleList) error

type RoleModel

type RoleModel struct {
	DB *sqlx.DB
}

func (*RoleModel) Delete

func (rm *RoleModel) Delete(id int64) error

func (*RoleModel) Get

func (rm *RoleModel) Get(id int64) (*Role, error)

func (*RoleModel) GetAbilities

func (rm *RoleModel) GetAbilities(roleID int64) ([]*Ability, error)

func (*RoleModel) GetAll

func (rm *RoleModel) GetAll() ([]*Role, error)

func (*RoleModel) GetAllByAbilityID

func (rm *RoleModel) GetAllByAbilityID(abilityID int64) ([]Role, error)

func (*RoleModel) GetAllByID

func (rm *RoleModel) GetAllByID(ids []int64) ([]*Role, error)

func (*RoleModel) GetAllByPerkID

func (rm *RoleModel) GetAllByPerkID(p *Perk) ([]Role, error)

func (*RoleModel) GetAllNames

func (rm *RoleModel) GetAllNames() ([]string, error)

func (*RoleModel) GetBulkByName

func (rm *RoleModel) GetBulkByName(names pq.StringArray) ([]*Role, error)

func (*RoleModel) GetByAbilityID

func (rm *RoleModel) GetByAbilityID(abilityID int64) (*Role, error)

func (*RoleModel) GetByFuzzy

func (rm *RoleModel) GetByFuzzy(name string) (*Role, error)

func (*RoleModel) GetByName

func (rm *RoleModel) GetByName(name string) (*Role, error)

func (*RoleModel) GetByPerkID

func (rm *RoleModel) GetByPerkID(perkID int64) (*Role, error)

func (*RoleModel) GetPerks

func (rm *RoleModel) GetPerks(RoleID int64) ([]*Perk, error)

func (*RoleModel) Insert

func (rm *RoleModel) Insert(r *Role) (int64, error)

func (*RoleModel) InsertJoinAbility

func (rm *RoleModel) InsertJoinAbility(roleID int64, abilityID int64) error

func (*RoleModel) InsertJoinPerk

func (rm *RoleModel) InsertJoinPerk(roleID int64, perkID int64) error

func (*RoleModel) Update

func (rm *RoleModel) Update(r *Role) error

func (*RoleModel) Upsert

func (rm *RoleModel) Upsert(r *Role) error

func (*RoleModel) WipeTable

func (rm *RoleModel) WipeTable() error

type Status

type Status struct {
	ID          int64  `db:"id" json:"id"`
	Name        string `db:"name" json:"name"`
	Description string `db:"description" json:"description"`
	CratedAt    string `db:"created_at" json:"created_at"`
}

type StatusModel

type StatusModel struct {
	DB *sqlx.DB
}

func (*StatusModel) Delete

func (sm *StatusModel) Delete(id int64) error

func (*StatusModel) Get

func (sm *StatusModel) Get(id int64) (*Status, error)

func (*StatusModel) GetAll

func (sm *StatusModel) GetAll() ([]Status, error)

func (*StatusModel) GetByFuzzy

func (sm *StatusModel) GetByFuzzy(name string) (*Status, error)

func (*StatusModel) GetByName

func (sm *StatusModel) GetByName(name string) (*Status, error)

func (*StatusModel) Insert

func (sm *StatusModel) Insert(s *Status) (int64, error)

func (*StatusModel) Update

func (sm *StatusModel) Update(status *Status) error

func (*StatusModel) Upsert

func (sm *StatusModel) Upsert(s *Status) error

type Vote

type Vote struct {
	ID        int    `db:"id" json:"id"`
	ChannelID string `db:"channel_id" json:"channel_id"`
}

type VoteModel

type VoteModel struct {
	DB *sqlx.DB
}

func (*VoteModel) Delete

func (v *VoteModel) Delete(vote Vote) error

func (*VoteModel) Get

func (v *VoteModel) Get() (*Vote, error)

func (*VoteModel) Insert

func (v *VoteModel) Insert(vote Vote) error

type Whitelist

type Whitelist struct {
	ID          int64  `db:"id" json:"id"`
	ChannelID   string `db:"channel_id" json:"channel_id"`
	GuildID     string `db:"guild_id" json:"guild_id"`
	ChannelName string `db:"channel_name" json:"channel_name"`
}

type WhitelistModel

type WhitelistModel struct {
	DB *sqlx.DB
}

func (*WhitelistModel) Delete

func (w *WhitelistModel) Delete(whitelist *Whitelist) (err error)

func (*WhitelistModel) GetAll

func (w *WhitelistModel) GetAll() (whitelists []*Whitelist, err error)

func (*WhitelistModel) GetByChannelName

func (w *WhitelistModel) GetByChannelName(channelName string) (whitelist *Whitelist, err error)

func (*WhitelistModel) Insert

func (w *WhitelistModel) Insert(whitelist *Whitelist) (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL