odata

package module
v0.0.0-...-727adce Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

OData Query processing

This is a library to process OData style queries especially $filter. It is not intended to be complete, but rather to cover the more reasonable aspects of the standard.

Examples of what is not covered:

  • Filtering inside of $orderby directives. i.e. Microsoft example of
http://host/service.svc/Orders?$orderby = ShipCountry ne 'France' desc

would instead need to be the following for this implementation

http://host/service.svc/Orders?$filter=ShipCountry ne 'France'&$orderby=ShipCountry desc
  • Expand is not currently covered
  • Some filter options including use of $it

If there are features you wish to add that don't compromise the simplicity of the code or majorly impact the speed please open a pull request.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGormSettingsFromGin

func GetGormSettingsFromGin(c *gin.Context, dbInput *gorm.DB) (*gorm.DB, error)

Types

type QueryOptions

type QueryOptions struct {
	Filter  *filter.Filter
	Select  *[]string
	OrderBy *orderby.OrderBy
	Top     int64
	Skip    int64
	Count   bool
}

func NewQueryOptions

func NewQueryOptions() *QueryOptions

func (*QueryOptions) AddCount

func (q *QueryOptions) AddCount(count bool)

func (*QueryOptions) AddFilter

func (q *QueryOptions) AddFilter(filterString string) error

func (*QueryOptions) AddOrderBy

func (q *QueryOptions) AddOrderBy(orderByString string) error

func (*QueryOptions) AddSelect

func (q *QueryOptions) AddSelect(selects []string)

func (*QueryOptions) AddSkip

func (q *QueryOptions) AddSkip(skip int64)

func (*QueryOptions) AddTop

func (q *QueryOptions) AddTop(top int64)

Directories

Path Synopsis
cmd
Package middleware provides an HTTP middleware for parsing OData query options from the URL and adding them to the request context.
Package middleware provides an HTTP middleware for parsing OData query options from the URL and adding them to the request context.

Jump to

Keyboard shortcuts

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