database

package
v0.0.0-...-748a0e7 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDataBase

func CloseDataBase()

Types

type CreateTaskParams

type CreateTaskParams struct {
	ID           uuid.UUID
	CreatedBy    uuid.UUID
	CreatedAt    time.Time
	LastEditedBy uuid.UUID
	LastEditedAt time.Time
	Title        string
	Link         string
	Platform     uuid.UUID
}

type CreateUserParams

type CreateUserParams struct {
	ID             uuid.UUID
	Email          string
	HashedPassword string
	Salt           string
	FirstName      string
	LastName       string
	AuthToken      string
	IsAdminUser    bool
	VerifiedUser   bool
}

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 Dtag

type Dtag struct {
	ID        uuid.UUID
	CreatedBy uuid.UUID
	CreatedAt time.Time
	Title     string
}

type EditAdminAccessParams

type EditAdminAccessParams struct {
	IsAdminUser bool
	Email       string
}

type GetAllAdminUsersRow

type GetAllAdminUsersRow struct {
	Email     string
	FirstName string
	LastName  string
}

type GetAllUsersRow

type GetAllUsersRow struct {
	Email     string
	FirstName string
	LastName  string
}

type Platform

type Platform struct {
	ID           uuid.UUID
	CreatedBy    uuid.UUID
	CreatedAt    time.Time
	Title        string
	PaltformLink string
}

type Querier

type Querier interface {
	CreateTask(ctx context.Context, arg CreateTaskParams) (Task, error)
	CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
	CreateUserVerification(ctx context.Context, userID uuid.UUID) (UserVerification, error)
	EditAdminAccess(ctx context.Context, arg EditAdminAccessParams) (User, error)
	GetAllAdminUsers(ctx context.Context) ([]GetAllAdminUsersRow, error)
	GetAllTasks(ctx context.Context) ([]Task, error)
	GetAllUsers(ctx context.Context) ([]GetAllUsersRow, error)
	GetUserFromAuthToken(ctx context.Context, authToken string) (User, error)
	GetUserFromEmail(ctx context.Context, email string) (User, error)
	GetUserVerificationEntryFromUserID(ctx context.Context, userID uuid.UUID) (UserVerification, error)
	SetUserVerificationTrue(ctx context.Context, id uuid.UUID) (User, error)
}

func InitialiseDatabase

func InitialiseDatabase() (Querier, error)

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateTask

func (q *Queries) CreateTask(ctx context.Context, arg CreateTaskParams) (Task, error)

func (*Queries) CreateUser

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

func (*Queries) CreateUserVerification

func (q *Queries) CreateUserVerification(ctx context.Context, userID uuid.UUID) (UserVerification, error)

func (*Queries) EditAdminAccess

func (q *Queries) EditAdminAccess(ctx context.Context, arg EditAdminAccessParams) (User, error)

func (*Queries) GetAllAdminUsers

func (q *Queries) GetAllAdminUsers(ctx context.Context) ([]GetAllAdminUsersRow, error)

func (*Queries) GetAllTasks

func (q *Queries) GetAllTasks(ctx context.Context) ([]Task, error)

func (*Queries) GetAllUsers

func (q *Queries) GetAllUsers(ctx context.Context) ([]GetAllUsersRow, error)

func (*Queries) GetUserFromAuthToken

func (q *Queries) GetUserFromAuthToken(ctx context.Context, authToken string) (User, error)

func (*Queries) GetUserFromEmail

func (q *Queries) GetUserFromEmail(ctx context.Context, email string) (User, error)

func (*Queries) GetUserVerificationEntryFromUserID

func (q *Queries) GetUserVerificationEntryFromUserID(ctx context.Context, userID uuid.UUID) (UserVerification, error)

func (*Queries) SetUserVerificationTrue

func (q *Queries) SetUserVerificationTrue(ctx context.Context, id uuid.UUID) (User, error)

func (*Queries) WithTx

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

type Task

type Task struct {
	ID           uuid.UUID
	CreatedBy    uuid.UUID
	CreatedAt    time.Time
	LastEditedBy uuid.UUID
	LastEditedAt time.Time
	Title        string
	Link         string
	Platform     uuid.UUID
}

type User

type User struct {
	ID             uuid.UUID
	Email          string
	HashedPassword string
	Salt           string
	FirstName      string
	LastName       string
	AuthToken      string
	IsAdminUser    bool
	VerifiedUser   bool
}

type UserVerification

type UserVerification struct {
	ID              uuid.UUID
	UserID          uuid.UUID
	CreatedAt       time.Time
	ValidTill       time.Time
	VerificationKey string
}

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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