blueprint

package
v0.0.0-...-ce5851c Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterByParam

func FilterByParam(controller *haruka.Context, name string, queryBuilder interface{}, methodName string, many bool)

FilterByParam binding query parameters to query builder

Types

type CreateModelView

type CreateModelView struct {
	Context          *haruka.Context
	CreateModel      func() interface{}
	ResponseTemplate serializer.TemplateSerializer
	RequestBody      interface{}
	OnBeforeCreate   func(v *CreateModelView, modelToCreate interface{})
	OnError          func(err error)
	GetValidators    func(v *CreateModelView) []validator.Validator
	OnCreate         func(view *CreateModelView, model interface{}) (interface{}, error)
}

CreateModelView create model view

func (*CreateModelView) Run

func (v *CreateModelView) Run()

type DefaultPagination

type DefaultPagination struct {
}

func (*DefaultPagination) Read

func (p *DefaultPagination) Read(ctx *haruka.Context) (int, int)

type DeleteModelView

type DeleteModelView struct {
	Context         *haruka.Context
	Lookup          string
	OnError         func(err error)
	Model           gormh.DataModel
	GetResponseBody func() interface{}
	GetValidators   func(v *DeleteModelView) []validator.Validator
}

func (*DeleteModelView) Run

func (v *DeleteModelView) Run()

type FilterMapping

type FilterMapping struct {
	Lookup string
	Method string
	Many   bool
}

type ListView

type ListView struct {
	Context              *haruka.Context
	Pagination           PageReader
	QueryBuilder         interface{}
	FilterMapping        []FilterMapping
	GetSerializerContext func(v *ListView, result interface{}) map[string]interface{}
	GetTemplate          func() serializer.TemplateSerializer
	GetContainer         func() serializer.ListContainerSerializer
	OnApplyQuery         func(v *ListView)
	OnError              func(err error)
}

ListView fetch models list view

func (*ListView) Run

func (v *ListView) Run()

type PageReader

type PageReader interface {
	Read(ctx *haruka.Context) (int, int)
}

type UpdateModelView

type UpdateModelView struct {
	Context       *haruka.Context
	Lookup        string
	OnError       func(err error)
	Model         gormh.DataModel
	Template      serializer.TemplateSerializer
	GetValidators func(v *UpdateModelView) []validator.Validator
	RequestBody   map[string]interface{}
}

func (*UpdateModelView) Run

func (v *UpdateModelView) Run()

Jump to

Keyboard shortcuts

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