db

package
v0.0.0-...-3e560f3 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Campaign

type Campaign struct {
	ID             int64
	Name           string
	Description    sql.NullString
	Key            string
	UserID         int64
	CreateDatetime time.Time
}

type Character

type Character struct {
	ID             int64
	Name           string
	PlayerName     string
	XpBonus        int64
	CampaignID     int64
	CreateDatetime time.Time
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type GetAllCharactersRow

type GetAllCharactersRow struct {
	ID             int64
	Name           string
	PlayerName     string
	XpBonus        int64
	CampaignID     int64
	CreateDatetime time.Time
	Username       string
}

type GetCampaignsWithCharacterCountRow

type GetCampaignsWithCharacterCountRow struct {
	ID             int64
	Name           string
	Description    sql.NullString
	CharacterCount int64
}

type GetCharacterWithXpRow

type GetCharacterWithXpRow struct {
	ID         int64
	Name       string
	PlayerName string
	CampaignID int64
	XpBonus    int64
	TotalXp    sql.NullFloat64
}

type GetCharactersForCampaignWithXpRow

type GetCharactersForCampaignWithXpRow struct {
	ID         int64
	Name       string
	PlayerName string
	CampaignID int64
	XpBonus    int64
	TotalXp    sql.NullFloat64
}

type InsertCampaignParams

type InsertCampaignParams struct {
	Name        string
	Description sql.NullString
	Key         string
	UserID      int64
}

type InsertCharacterParams

type InsertCharacterParams struct {
	Name       string
	PlayerName string
	XpBonus    int64
	CampaignID int64
}

type InsertUserParams

type InsertUserParams struct {
	Username string
	Realname sql.NullString
	Password string
}

type InsertXpAwardParams

type InsertXpAwardParams struct {
	XpAward          int64
	XpAwardWithBonus int64
	Reason           string
	CharacterID      int64
}

type InsertXpBonusForCharacterParams

type InsertXpBonusForCharacterParams struct {
	XpBonus     int64
	Reason      string
	CharacterID int64
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) DeleteCharacter

func (q *Queries) DeleteCharacter(ctx context.Context, id int64) error

func (*Queries) DeleteXpAwardsForCharacter

func (q *Queries) DeleteXpAwardsForCharacter(ctx context.Context, characterID int64) error

func (*Queries) DeleteXpBonusForCharacter

func (q *Queries) DeleteXpBonusForCharacter(ctx context.Context, characterID int64) error

func (*Queries) GetAllCharacters

func (q *Queries) GetAllCharacters(ctx context.Context) ([]GetAllCharactersRow, error)

func (*Queries) GetCampaignById

func (q *Queries) GetCampaignById(ctx context.Context, id int64) (Campaign, error)

func (*Queries) GetCampaignByName

func (q *Queries) GetCampaignByName(ctx context.Context, name string) (Campaign, error)

func (*Queries) GetCampaigns

func (q *Queries) GetCampaigns(ctx context.Context, userID int64) ([]Campaign, error)

func (*Queries) GetCampaignsWithCharacterCount

func (q *Queries) GetCampaignsWithCharacterCount(ctx context.Context, userID int64) ([]GetCampaignsWithCharacterCountRow, error)

func (*Queries) GetCharacterById

func (q *Queries) GetCharacterById(ctx context.Context, id int64) (Character, error)

func (*Queries) GetCharacterWithXp

func (q *Queries) GetCharacterWithXp(ctx context.Context, id int64) (GetCharacterWithXpRow, error)

func (*Queries) GetCharactersForCampaign

func (q *Queries) GetCharactersForCampaign(ctx context.Context, campaignID int64) ([]Character, error)

func (*Queries) GetCharactersForCampaignWithXp

func (q *Queries) GetCharactersForCampaignWithXp(ctx context.Context, campaignID int64) ([]GetCharactersForCampaignWithXpRow, error)

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, username string) (User, error)

func (*Queries) GetUserId

func (q *Queries) GetUserId(ctx context.Context, username string) (int64, error)

func (*Queries) GetUsers

func (q *Queries) GetUsers(ctx context.Context) ([]User, error)

func (*Queries) GetXpAwardsForCharacter

func (q *Queries) GetXpAwardsForCharacter(ctx context.Context, characterID int64) ([]XpAward, error)

func (*Queries) GetXpBonusForCharacter

func (q *Queries) GetXpBonusForCharacter(ctx context.Context, characterID int64) ([]XpBonusReason, error)

func (*Queries) InsertCampaign

func (q *Queries) InsertCampaign(ctx context.Context, arg InsertCampaignParams) (Campaign, error)

func (*Queries) InsertCharacter

func (q *Queries) InsertCharacter(ctx context.Context, arg InsertCharacterParams) (Character, error)

func (*Queries) InsertUser

func (q *Queries) InsertUser(ctx context.Context, arg InsertUserParams) (User, error)

func (*Queries) InsertXpAward

func (q *Queries) InsertXpAward(ctx context.Context, arg InsertXpAwardParams) (XpAward, error)

func (*Queries) InsertXpBonusForCharacter

func (q *Queries) InsertXpBonusForCharacter(ctx context.Context, arg InsertXpBonusForCharacterParams) (XpBonusReason, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type User

type User struct {
	ID             int64
	Username       string
	Realname       sql.NullString
	Password       string
	CreateDatetime time.Time
}

type XpAward

type XpAward struct {
	ID               int64
	XpAward          int64
	XpAwardWithBonus int64
	Reason           string
	CharacterID      int64
	CreateDatetime   time.Time
}

type XpBonusReason

type XpBonusReason struct {
	ID             int64
	XpBonus        int64
	Reason         string
	CharacterID    int64
	CreateDatetime time.Time
}

Jump to

Keyboard shortcuts

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