models

package
v0.0.0-...-4278e99 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func ConnectDatabase

func ConnectDatabase()

Types

type CreateExpenseInput

type CreateExpenseInput struct {
	Name     string  `json:"name" binding:"required"`
	Category string  `json:"category" binding:"required"`
	Cost     float32 `json:"cost" binding:"required"`
	Sharing  float32 `json:"sharing" binding:"required"`
	Date     string  `json:"date"`
	Notes    string  `json:"notes"`
	GroupID  uint    `json:"group_id"`
}

type Expense

type Expense struct {
	ID       uint    `json:"id" gorm:"primary_key"`
	Name     string  `json:"name" validate:"min=3,max=40"`
	Category string  `json:"category" validate:"min=1,max=20,regexp=^[a-z]*$"`
	Cost     float32 `json:"cost" validate:"min=0.01,max=1000000"`
	Sharing  float32 `json:"sharing" validate:"min=0.00,max=1.00"`
	Date     string  `json:"date" validate:"regexp=^(\\d{4}-([0]\\d|1[0-2])-([0-2]\\d|3[01]))?$"`
	Notes    string  `json:"notes" validate:"min=0,max=10000"`
	UserID   uint    `json:"user_id"`
	GroupID  uint    `json:"group_id" validate:"min=0"`
}

type Group

type Group struct {
	ID   uint   `json:"id" gorm:"primary_key"`
	Name string `json:"name"`
}

type UpdateExpenseInput

type UpdateExpenseInput struct {
	Name     string  `json:"name"`
	Category string  `json:"category"`
	Cost     float32 `json:"cost"`
	Sharing  float32 `json:"sharing"`
	Date     string  `json:"date"`
	Notes    string  `json:"notes"`
}

type User

type User struct {
	ID       uint   `json:"id" gorm:"primary_key"`
	Name     string `json:"name"`
	Password string `json:"-"`
}

Jump to

Keyboard shortcuts

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