db

package
v0.0.0-...-741e748 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assets

type Assets struct {
	ID        int64  `json:"id"`
	Name      string `json:"name"`
	UrlPath   string `json:"urlPath"`
	FileID    int64  `json:"fileID"`
	CreatorID int64  `json:"creatorID"`
}

type Challenges

type Challenges struct {
	ID          int64  `json:"id"`
	Title       string `json:"title"`
	AuthorID    int64  `json:"authorID"`
	Description string `json:"description"`
	Rules       string `json:"rules"`
	Reward      int32  `json:"reward"`
}

type Challengesubmissions

type Challengesubmissions struct {
	ID          int64  `json:"id"`
	ChallengeID int64  `json:"challengeID"`
	Code        string `json:"code"`
	Language    string `json:"language"`
	AuthorID    int64  `json:"authorID"`
}

type CreateAssetParams

type CreateAssetParams struct {
	Mimetype  string `json:"mimetype"`
	Name      string `json:"name"`
	Data      []byte `json:"data"`
	Name_2    string `json:"name2"`
	UrlPath   string `json:"urlPath"`
	CreatorID int64  `json:"creatorID"`
}

type CreateUserParams

type CreateUserParams struct {
	ID            int64  `json:"id"`
	Username      string `json:"username"`
	Discriminator string `json:"discriminator"`
}

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 DeleteAssetParams

type DeleteAssetParams struct {
	UrlPath   string `json:"urlPath"`
	CreatorID int64  `json:"creatorID"`
}

type Files

type Files struct {
	ID       int64  `json:"id"`
	Name     string `json:"name"`
	Mimetype string `json:"mimetype"`
	Data     []byte `json:"data"`
}

type GetAssetDetailsByIdRow

type GetAssetDetailsByIdRow struct {
	UrlPath   string `json:"urlPath"`
	Name      string `json:"name"`
	CreatorID int64  `json:"creatorID"`
}

type GetAssetDetailsByUrlRow

type GetAssetDetailsByUrlRow struct {
	ID        int64  `json:"id"`
	Name      string `json:"name"`
	CreatorID int64  `json:"creatorID"`
}

type GetFileRow

type GetFileRow struct {
	Data     []byte `json:"data"`
	Mimetype string `json:"mimetype"`
}

type ListAssetByCreatorParams

type ListAssetByCreatorParams struct {
	CreatorID int64 `json:"creatorID"`
	Limit     int32 `json:"limit"`
	Offset    int32 `json:"offset"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateAsset

func (q *Queries) CreateAsset(ctx context.Context, arg CreateAssetParams) (int64, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) error

((Pagenumber - 1) * PageSize)

func (*Queries) DeleteAsset

func (q *Queries) DeleteAsset(ctx context.Context, arg DeleteAssetParams) error

func (*Queries) GetAssetDetailsById

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

func (*Queries) GetAssetDetailsByUrl

func (q *Queries) GetAssetDetailsByUrl(ctx context.Context, urlPath string) (GetAssetDetailsByUrlRow, error)

func (*Queries) GetFile

func (q *Queries) GetFile(ctx context.Context, urlPath string) (GetFileRow, error)

func (*Queries) ListAssetByCreator

func (q *Queries) ListAssetByCreator(ctx context.Context, arg ListAssetByCreatorParams) ([]Assets, error)

func (*Queries) WithTx

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

type Store

type Store struct {
	*Queries // Embedding Queries struct generated by sqlc
	// contains filtered or unexported fields
}

Store provides all functions to execute db queries and transactions

func NewStore

func NewStore(db *sql.DB) *Store

NewStore Creates a New Store

func (*Store) CreateAssetFile

func (store *Store) CreateAssetFile(ctx context.Context, arg CreateAssetParams) (int64, error)

CreateAssetFile Creates assets and files in a transaction so that errors can be caught before committing

type Tokens

type Tokens struct {
	UserID    int64           `json:"userID"`
	ExpiresAt time.Time       `json:"expiresAt"`
	Token     string          `json:"token"`
	Data      json.RawMessage `json:"data"`
}

type Users

type Users struct {
	ID            int64          `json:"id"`
	Username      string         `json:"username"`
	Discriminator string         `json:"discriminator"`
	Avatar        sql.NullString `json:"avatar"`
	App           bool           `json:"app"`
}

Jump to

Keyboard shortcuts

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