dbtools

package
v0.0.0-...-bce2eae Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OffersAsMaps

func OffersAsMaps(offers []Offer) []fiber.Map

func TagsAsMap

func TagsAsMap(tags []Tag) []string

Types

type Offer

type Offer struct {
	Offer_id    int64     `field:"offer_id"`
	User_id     int64     `field:"user_id"`
	Title       string    `field:"title"`
	Description string    `field:"description"`
	Uploaded    time.Time `field:"uploaded"`
	PrettyTime  string
	Tags        []Tag
	User        *User
}

====Offers====

func EmptyOffer

func EmptyOffer() *Offer

func GetOfferFromId

func GetOfferFromId(offer_id int64, db *sql.DB) (*Offer, error)

func GetOffers

func GetOffers(db *sql.DB) ([]Offer, error)

func NewOffer

func NewOffer(user_id int64, title, description string, stringTags []string) *Offer

func (*Offer) AddToDB

func (o *Offer) AddToDB(db *sql.DB) error

func (*Offer) AsMap

func (o *Offer) AsMap() fiber.Map

type Tag

type Tag struct {
	Offer_id int64  `field:"offer_id"`
	Tag      string `field:"tag"`
}

func EmptyTag

func EmptyTag() *Tag

func GetTagsFromId

func GetTagsFromId(offer_id int64, db *sql.DB) ([]Tag, error)

func (*Tag) AddToDB

func (t *Tag) AddToDB(db *sql.DB) error

type User

type User struct {
	User_id     int64  `field:"user_id"`
	Username    string `field:"username"`
	Email       string `field:"email"`
	Description string `field:"description"`
	Password    string `field:"password"`
}

====Users====

func EmptyUser

func EmptyUser() *User

func GetUserFromEmail

func GetUserFromEmail(email string, db *sql.DB) (*User, error)

func GetUserFromId

func GetUserFromId(user_id int64, db *sql.DB) (*User, error)

func GetUserFromUsername

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

func NewUser

func NewUser(username, email, password string) *User

func (*User) AddToDB

func (u *User) AddToDB(db *sql.DB) error

func (*User) AsMap

func (u *User) AsMap() fiber.Map

func (*User) Update

func (u *User) Update(db *sql.DB) error

Jump to

Keyboard shortcuts

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