models

package
v0.0.0-...-376f4e9 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateExpense

func CreateExpense(db *bun.DB, expense *Expense) error

Types

type Expense

type Expense struct {
	bun.BaseModel `bun:"table:expenses" json:"-"`

	ID          int       `bun:",pk,autoincrement"`
	UserID      int       `bun:",notnull"`
	Amount      float64   `bun:",notnull"`
	Category    string    `bun:",notnull"`
	Description string    `bun:",notnull"`
	CreatedAt   time.Time `bun:",nullzero,notnull,default:current_timestamp"`
}

type User

type User struct {
	bun.BaseModel `bun:"table:users" json:"-"`

	ID        int       `bun:",pk,autoincrement"`
	Username  string    `bun:",unique,notnull"`
	Email     string    `bun:",unique,notnull"`
	Password  string    `bun:",notnull"`
	Role      string    `bun:",notnull,default:'user'"`
	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
}

func (*User) ComparePassword

func (u *User) ComparePassword(password string) bool

func (*User) HashPassword

func (u *User) HashPassword() error

Jump to

Keyboard shortcuts

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