models

package
v0.0.0-...-232894a Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BudgetAcct

type BudgetAcct struct {
	ID            int            `json:"id"`
	UserID        int            `json:"user_id"`
	Item          string         `json:"item"`
	Description   string         `json:"description"`
	Amount        float64        `json:"amount"`
	BudgetingType string         `json:"budgeting_type"`
	Biweekly      bool           `json:"biweekly"`
	ApplyDefault  bool           `json:"apply_default_amount"`
	DefaultAmt    float64        `json:"default_amt"`
	CreatedAt     time.Time      `json:"created_at"`
	UpdatedAt     time.Time      `json:"updated_at"`
	TerminatedAt  time.Time      `json:"terminated_at"`
	Tags          map[int]string `json:"tags"`
}

Type for budgeting account items

type BudgetTag

type BudgetTag struct {
	ID          int    `json:"-"`
	TagID       int    `json:"-"`
	ItemID      int    `json:"-"`
	Description string `json:"description"`
}

Type for tags

type DBModel

type DBModel struct {
	DB *sql.DB
}

func (*DBModel) All

func (m *DBModel) All(tag ...int) ([]*BudgetAcct, error)

Returns all movies and error if any

func (*DBModel) AllTags

func (m *DBModel) AllTags() ([]*Tag, error)

func (*DBModel) AllUsers

func (m *DBModel) AllUsers() ([]*User, error)

func (*DBModel) DeleteBudgetItem

func (m *DBModel) DeleteBudgetItem(id int) error

func (*DBModel) DeleteUser

func (m *DBModel) DeleteUser(id int) error

func (*DBModel) Get

func (m *DBModel) Get(id int) (*BudgetAcct, error)

Returns one budget item and error if any

func (*DBModel) GetOneUser

func (m *DBModel) GetOneUser(email string) (*User, error)

get one user

func (*DBModel) GetUserPref

func (m *DBModel) GetUserPref(user_id int) (*UserPreferences, error)

func (*DBModel) InsertBudgetItem

func (m *DBModel) InsertBudgetItem(budgetacct BudgetAcct) error

func (*DBModel) InsertUser

func (m *DBModel) InsertUser(user User) error

func (*DBModel) UpdateBudgetItem

func (m *DBModel) UpdateBudgetItem(budgetacct BudgetAcct) error

func (*DBModel) UpdateUser

func (m *DBModel) UpdateUser(user User) error

type Models

type Models struct {
	DB DBModel
}

Models is the wrapper for database

func NewModels

func NewModels(db *sql.DB) Models

New Models returns models with db pool

type Tag

type Tag struct {
	TagID       int       `json:"id"`
	Description string    `json:"description"`
	CreatedAt   time.Time `json:"-"`
	UpdatedAt   time.Time `json:"-"`
}

Type for tags

type User

type User struct {
	ID       int    `json:"_"`
	Email    string `json:"email"`
	Password string `json:"-"`
}

type UserPreferences

type UserPreferences struct {
	ID                      int    `json:"id"`
	User_id                 string `json:"user_id"`
	Budget_items_sort_order []int  `json:"budget_items_sort_order"`
}

Jump to

Keyboard shortcuts

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