services

package
v0.0.0-...-e7d8ea6 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a resource cannot be found
	ErrNotFound = errors.New("models: resource not found")

	// ErrInvalidID is returned when an invalid ID is provided
	// to a method like Delete.
	ErrInvalidID = errors.New("models: ID provided was invalid")
)

Functions

This section is empty.

Types

type EmployeeService

type EmployeeService struct {
	// contains filtered or unexported fields
}

EmployeeService struct

func NewEmployeeService

func NewEmployeeService(connectionInfo string) (*EmployeeService, error)

NewEmployeeService func

func (*EmployeeService) AutoMigrate

func (es *EmployeeService) AutoMigrate() error

AutoMigrate will attempt to Automigrate the users table

func (*EmployeeService) ByCity

func (es *EmployeeService) ByCity(city string) *[]models.Employee

ByCity will look up a employee by name provided 1 - employee, nil 2 - nil, ErrNoFound 3 - nil, otherError

func (*EmployeeService) ByID

func (es *EmployeeService) ByID(id uint) (*models.Employee, error)

ByID will look up a employee by id provided 1 - employee, nil 2 - nil, ErrNoFound 3 - nil, otherError

func (*EmployeeService) ByName

func (es *EmployeeService) ByName(name string) (*models.Employee, error)

ByName will look up a employee by name provided 1 - employee, nil 2 - nil, ErrNoFound 3 - nil, otherError

func (*EmployeeService) Close

func (es *EmployeeService) Close() error

Close the UserService database connection

func (*EmployeeService) Create

func (es *EmployeeService) Create(employee *models.Employee) error

Create will add employee into the database

func (*EmployeeService) Delete

func (es *EmployeeService) Delete(id uint) error

Delete will delete employee with provided ID

func (*EmployeeService) DestructiveReset

func (es *EmployeeService) DestructiveReset() error

DestructiveReset drops table and rebuilds it

func (*EmployeeService) GetAll

func (es *EmployeeService) GetAll() *[]models.Employee

GetAll will look up all employees

func (*EmployeeService) Update

func (es *EmployeeService) Update(employee *models.Employee) error

Update will update employee provisioned with employee object

Jump to

Keyboard shortcuts

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