services

package
v0.0.0-...-1dfef78 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CRUDHandler

type CRUDHandler struct {
	Service *CRUDService
	Name    string
	// contains filtered or unexported fields
}

func NewCRUDHandler

func NewCRUDHandler(n string, s *CRUDService) *CRUDHandler

func (*CRUDHandler) Create

func (crud *CRUDHandler) Create(c echo.Context) error

func (*CRUDHandler) Delete

func (crud *CRUDHandler) Delete(c echo.Context) error

func (*CRUDHandler) GetByID

func (crud *CRUDHandler) GetByID(c echo.Context) error

func (*CRUDHandler) List

func (crud *CRUDHandler) List(c echo.Context) error

func (*CRUDHandler) Update

func (crud *CRUDHandler) Update(c echo.Context) error

type CRUDReq

type CRUDReq struct {
	Data map[string]interface{} `json:"data"`
}

CRUDReq for CreateUpdateReq

type CRUDService

type CRUDService struct {
	Model      models.Model
	Type       reflect.Type
	Preloads   []string
	Results    interface{}
	Entity     models.Entity
	EntityName string
	// contains filtered or unexported fields
}

func NewCrudService

func NewCrudService(model models.Model, v models.Entity, entity string, preloads []string, d *gorm.DB) *CRUDService

func (*CRUDService) Create

func (cs *CRUDService) Create(obj interface{}) error

func (*CRUDService) Delete

func (cs *CRUDService) Delete(obj interface{}, id int64) error

func (*CRUDService) GetAll

func (cs *CRUDService) GetAll() (interface{}, int64, error)

func (*CRUDService) GetByID

func (cs *CRUDService) GetByID(item interface{}, id int64) error

func (*CRUDService) GetByUID

func (cs *CRUDService) GetByUID(uid string, item interface{}) error

func (*CRUDService) GetNew

func (cs *CRUDService) GetNew() models.Model

func (*CRUDService) Joins

func (cs *CRUDService) Joins(join string) (interface{}, int64, error)

func (*CRUDService) List

func (cs *CRUDService) List(l *ListParams) (interface{}, int64, error)

func (*CRUDService) Update

func (cs *CRUDService) Update(obj interface{}, id int64) error

func (*CRUDService) Where

func (cs *CRUDService) Where(condition string, args ...interface{}) (interface{}, int64, error)

type Criteria

type Criteria map[string]interface{}

type ICRUDHandler

type ICRUDHandler interface {
	Create(c echo.Context) error
	Update(c echo.Context) error
	Delete(c echo.Context) error
	GetByID(c echo.Context) error
	List(c echo.Context) error
}

type ICRUDService

type ICRUDService interface {
	GetByID(interface{}, int64) error
	GetByUID(string, interface{}) error
	Create(interface{}) error
	Update(interface{}, int64) error
	Delete(interface{}, int64) error
	GetAll() (interface{}, int64, error)
	List(l ListParams) (interface{}, int64, error)
	Where(condition string, args ...interface{}) (interface{}, int64, error)
	Joins(join string) (interface{}, int64, error)
}

type ListParams

type ListParams struct {
	Limit    int      `json:"limit"`
	Criteria Criteria `json:"criteria"`
}

type ListReq

type ListReq struct {
	Params ListParams `json:"params"`
}

type ProjectHandler

type ProjectHandler struct {
	CRUDHandler
	Teacher      CRUDService
	Student      CRUDService
	Subject      CRUDService
	ProjectState CRUDService
	Preloads     []string
}

func NewProjectHandler

func NewProjectHandler(d *gorm.DB, s *CRUDService) *ProjectHandler

func (*ProjectHandler) Create

func (ph *ProjectHandler) Create(c echo.Context) error

func (*ProjectHandler) GetByID

func (ph *ProjectHandler) GetByID(c echo.Context) error

func (*ProjectHandler) List

func (ph *ProjectHandler) List(c echo.Context) error

func (*ProjectHandler) Patch

func (ph *ProjectHandler) Patch(c echo.Context) error

func (*ProjectHandler) Update

func (ph *ProjectHandler) Update(c echo.Context) error

type ProjectPatchForm

type ProjectPatchForm struct {
	Title          string `json:"title"`
	Desc           string `json:"desc"`
	ProjectStateID int64  `json:"project_state_id"`
}

Jump to

Keyboard shortcuts

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