models

package
v0.0.0-...-8b6cda5 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAuth

func CheckAuth(username, password string) (bool, error)

CheckAuth checks if authentication information exists

func Setup

func Setup()

Setup initializes the database instance

Types

type Auth

type Auth struct {
	ID       int    `json:"id" gorm:"primary_key"`
	Username string `json:"username" gorm:"not null;unique"`
	Password string `json:"password" gorm:"not null"`
}

type Customer

type Customer struct {
	Model
	FirstName  string `json:"firstName" validate:"required" gorm:"not null"`
	LastName   string `json:"lastName" validate:"required" gorm:"not null"`
	Title      string `json:"title" validate:"required" gorm:"not null"`
	CreatedBy  string `json:"createdBy"`
	ModifiedBy string `json:"modifiedBy"`
}

func AddNewCustomer

func AddNewCustomer(customer Customer) (*Customer, error)

func GetCustomerById

func GetCustomerById(id int) (*Customer, error)

type Model

type Model struct {
	ID         int       `gorm:"primary_key" json:"id"`
	CreatedOn  time.Time `json:"createdOn" sql:"DEFAULT:'current_timestamp'"`
	ModifiedOn time.Time `json:"modifiedOn"`
}

Jump to

Keyboard shortcuts

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