filters

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2017 License: GPL-3.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Pagination
	Code      string `bind:"code_train"`
	StationID int    `bind:"station_id"`
}

Alert filter

func (*Alert) ApplyFilter

func (f *Alert) ApplyFilter(db *gorm.DB) *gorm.DB

ApplyFilter on query

type Filter

type Filter interface {
	ApplyFilter(db *gorm.DB) *gorm.DB
	ApplyPagination(db *gorm.DB) *gorm.DB
	GetPage() int
	GetLimit() int
}

Filter interface

type Pagination

type Pagination struct {
	Page  int `bind:"_page"`
	Limit int `bind:"_limit_per_page"`
}

Pagination query param

func (*Pagination) ApplyFilter

func (p *Pagination) ApplyFilter(db *gorm.DB) *gorm.DB

ApplyFilter on query

func (*Pagination) ApplyPagination

func (p *Pagination) ApplyPagination(db *gorm.DB) *gorm.DB

ApplyPagination on query

func (*Pagination) GetLimit

func (p *Pagination) GetLimit() int

GetLimit return safe limit_per_page (no negative or too large)

func (*Pagination) GetPage

func (p *Pagination) GetPage() int

GetPage return safe page (no negative)

type Station

type Station struct {
	Pagination
	Name string `bind:"name"`
}

Station filter

func (*Station) ApplyFilter

func (f *Station) ApplyFilter(db *gorm.DB) *gorm.DB

ApplyFilter on query

type Stop

type Stop struct {
	Pagination
	TerminusID            uint   `bind:"terminus_id"`
	TerminusName          string `bind:"terminus_name"`
	TrainThroughStationID uint   `bind:"train_through_station_id"`
	Mission               string `bind:"mission"`
}

Stop filters

func (*Stop) ApplyFilter

func (f *Stop) ApplyFilter(db *gorm.DB) *gorm.DB

ApplyFilter on query

Jump to

Keyboard shortcuts

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