data

package
v0.0.0-...-9928b23 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeletePirg

func DeletePirg(db *sql.DB, id int) error

func DeleteUser

func DeleteUser(db *sql.DB, id int) error

func NewDBConn

func NewDBConn(dbr DBRequest) (*sql.DB, error)

func UpdateUser

func UpdateUser(db *sql.DB, userId int, user *UserRequest) error

func WipeDB

func WipeDB(db *sql.DB) error

Types

type APIKeyEntry

type APIKeyEntry struct {
	Key        string
	Role       string
	CreatedAt  time.Time
	ModifiedAt time.Time
}

func GetAPIKeyEntry

func GetAPIKeyEntry(db *sql.DB, key string) (*APIKeyEntry, error)

GetAPIKeyEntry looks for the provided key in the database and returns the APIKeyEntry if found, nil if not found, or an error

type DBRequest

type DBRequest struct {
	Host       string
	Port       int
	User       string
	Password   string
	DBName     string
	DisableSSL bool
}

func NewDBRequest

func NewDBRequest(host string, port int, user, password, dbname string, disableSSL bool) (DBRequest, error)

type Pirg

type Pirg struct {
	Id         int       `json:"id"`
	Name       string    `json:"name"`
	OwnerId    int       `json:"owner_id"`
	AdminIds   []int     `json:"admin_ids"`
	UserIds    []int     `json:"user_ids"`
	CreatedAt  time.Time `json:"created_at"`
	ModifiedAt time.Time `json:"modified_at"`
}

func CreatePirg

func CreatePirg(db *sql.DB, pirg *PirgRequest) (*Pirg, error)

func GetAllPirgs

func GetAllPirgs(db *sql.DB) ([]*Pirg, error)

func GetPirgById

func GetPirgById(db *sql.DB, id int) (*Pirg, error)

func GetPirgByName

func GetPirgByName(db *sql.DB, name string) (*Pirg, error)

func UpdatePirg

func UpdatePirg(db *sql.DB, id int, pr *PirgRequest) (*Pirg, error)

type PirgRequest

type PirgRequest struct {
	Name     string `json:"name"`
	OwnerId  int    `json:"owner_id"`
	AdminIds []int  `json:"admin_ids"`
	UserIds  []int  `json:"user_ids"`
}

type User

type User struct {
	Id         int
	Username   string
	Email      string
	FirstName  string
	LastName   string
	CreatedAt  time.Time
	ModifiedAt time.Time
}

func CreateUser

func CreateUser(db *sql.DB, user *UserRequest) (*User, error)

func GetAllUsers

func GetAllUsers(db *sql.DB) ([]*User, error)

func GetUserById

func GetUserById(db *sql.DB, id int) (*User, error)

func GetUserByUsername

func GetUserByUsername(db *sql.DB, username string) (*User, error)

type UserRequest

type UserRequest struct {
	Username  string
	Email     string
	FirstName string
	LastName  string
}

Jump to

Keyboard shortcuts

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