query

package
v0.3.21 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeOrderQuery added in v0.3.17

func MakeOrderQuery(q Param, w *gorm.DB, resultLinkQueryString string) (*gorm.DB, string)

MakeOrderQuery 이전 쿼리에다 정렬 관련 쿼리를 붙여준다

func MakeQuery added in v0.3.17

func MakeQuery(q Param, rw *gorm.DB) (string, *gorm.DB, *gorm.DB)

MakeQuery 전체적으로 쿼리를 만들어준다

func MakeRawQuery added in v0.3.17

func MakeRawQuery(q Param, w *gorm.DB) (string, *gorm.DB)

MakeRawQuery 정렬 전 쿼리를 만들어준다

Types

type BulkActionRequest

type BulkActionRequest struct {
	Action  string                    `json:"action"`
	Targets jsonconv.Int64StringSlice `json:"target_list,omitempty"`
}

func (*BulkActionRequest) Valid

func (req *BulkActionRequest) Valid() bool
type NavigationLinks struct {
	//"base": "http://localhost:8080/confluence",
	Base    string `json:"base,omitempty"`
	Context string `json:"context,omitempty"`
	//"next": "/rest/api/space/ds/content/page?limit=5&start=5",
	Next string `json:"next,omitempty"`
	//  "prev": "/rest/api/space/ds/content/page?limit=5&start=0",
	Prev string `json:"prev,omitempty"`
	//"self": "http://localhost:8080/confluence/rest/api/space/ds/content/page"
	Self string `json:"self,omitempty"`
}

type Param

type Param struct {
	// id.asc or id.desc,created_at.asc
	OrderBy     string `json:"order_by,omitempty" query:"o"`
	QueryString string `json:"query_string,omitempty" query:"q"`
	// qt=name,position
	QueryTarget string                 `json:"query_target,omitempty" query:"qt"`
	Start       int                    `json:"start,omitempty" query:"s"`
	Limit       int                    `json:"limit,omitempty" query:"l"`
	QueryExact  string                 `json:"query_exact,omitempty" query:"qx"`
	QueryValues map[string]interface{} `json:"-"`
	After       int64                  `json:"after_id,string,omitempty" query:"afi"`
	Before      int64                  `json:"before_id,string,omitempty" query:"bfi"`
}

func New

func New(c echo.Context) (*Param, error)

func (*Param) FromContextInt64

func (p *Param) FromContextInt64(c echo.Context, key string) bool

func (*Param) FromContextString

func (p *Param) FromContextString(c echo.Context, key string) bool

func (*Param) SetValue

func (p *Param) SetValue(key string, value interface{})

type Response

type Response struct {
	Param
	// 다른 link와 헷갈리지 않도록 _를 붙여둔다.
	Links  NavigationLinks `json:"_links"`
	Result interface{}     `json:"result"`
	// 결과 크기
	Size int `json:"size"`
	// 전체 갯수
	Total int `json:"total"`
}

func MakeResponse added in v0.3.17

func MakeResponse(q Param, orderedWhere *gorm.DB, unorderedWhere *gorm.DB, orderedResultQueryString string, out interface{}) (*Response, error)

MakeResponse 만든 쿼리를 가지고 Response 객체를 만든다

func Query

func Query(q Param, db *gorm.DB, out interface{}) (*Response, error)

Jump to

Keyboard shortcuts

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