filters

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 9, 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 StopTime

type StopTime struct {
	Pagination
	TrainThroughStationID uint   `bind:"train_through_station_id"`
	Mission               string `bind:"mission"`
	ScheduledBefore       string `bind:"scheduled_before"`
	ScheduledAfter        string `bind:"scheduled_after"`
	ScheduledAt           string `bind:"scheduled_at"`
}

StopTime filters

func (*StopTime) ApplyFilter

func (f *StopTime) 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