models

package
v0.0.0-...-d0503b8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func Setup

func Setup()

Initilize the database and prep database tables

Types

type Group

type Group struct {
	gorm.Model
	GroupName    string  `json:"groupName"`
	Contribution float64 `json:"contribution"`
	Amount       float64 `json:"amount"`
	Users        *[]User `json:"users"`
}

type User

type User struct {
	gorm.Model
	FirstName  string  `json:"firstname"`
	LastName   string  `json:"lastname"`
	Email      string  `json:"email"`
	Phone      string  `json:"phone"`
	Amount     float64 `json:"amount"`
	NationalId string  `json:"nationalId"`
	GroupID    string  `json:"groupId"`
}

Define structure for users of th application

func (*User) CreateUser

func (usr *User) CreateUser() (User, error)

func (*User) DeleteUser

func (usr *User) DeleteUser() (string, error)

func (*User) GetUser

func (*User) GetUser(userID string) User

func (*User) GetUsers

func (*User) GetUsers() []User

func (*User) UpdateUser

func (usr *User) UpdateUser(userData User) (User, error)

Jump to

Keyboard shortcuts

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