tecgrid

package
v0.0.0-...-dd30ea9 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

This package is a helper for parsing http request from AngularJs application to GO api's I have developed

Index

Constants

View Source
const (
	QS_SORT_DIRECTION = "sortDirection"
	QS_SORT_FIELD     = "sortField"
	QS_PAGE_NUMBER    = "pageNumber"
	QS_PAGE_SIZE      = "pageSize"
	QS_QUERY          = "query"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type NgGrid

type NgGrid struct {
	PageNumber     int64       `json:"pageNumber"`
	PageSize       int64       `json:"pageSize"`
	Query          string      `json:"query"`
	SortDirection  string      `json:"sortDirection"`
	SortField      string      `json:"sortField"`
	TotalCount     int64       `json:"totalCount"`
	FilterCount    int64       `json:"filterCount"`
	Rows           interface{} `json:"rows"`
	GeneratedQuery string      `json:"-"`
	MainQuery      string      `json:"-"`
}

The main structure for parsing objects from json client

func ParseQueryString

func ParseQueryString(values map[string][]string) *NgGrid

Parses a query string from url into NgGrid Useful when you are dealing with GET methods instead of POST and decoding

func (*NgGrid) ExecuteSqlParameters

func (g *NgGrid) ExecuteSqlParameters(tx gorp.SqlExecutor, target interface{}, fields []string, pars []interface{}) (err error)

Executes sql statements along with its parameters

func (*NgGrid) FromRow

func (g *NgGrid) FromRow() int64

func (*NgGrid) GenerateSql

func (g *NgGrid) GenerateSql(tx gorp.SqlExecutor, fields []string) error

Generates the sql and calculates the number of rows from the result query

func (*NgGrid) GetPageNumber

func (g *NgGrid) GetPageNumber() int64

Calculates the page number

func (*NgGrid) GetPageSize

func (g *NgGrid) GetPageSize() int64

Calculates the page size

func (*NgGrid) GetQuery

func (g *NgGrid) GetQuery() string

Returns the actual query to lowercase

func (*NgGrid) Limit

func (g *NgGrid) Limit() int64

The same as pageSize

func (*NgGrid) Skip

func (g *NgGrid) Skip() int64

Helper for getting the number of rows I need to skip based on pageNumber and pageSize values

func (*NgGrid) ToRow

func (g *NgGrid) ToRow() int64

Jump to

Keyboard shortcuts

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