filter

package
v0.0.0-...-52b58a3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: Apache-2.0, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

See reference at https://sldn.softlayer.com/article/object-filters. Examples in the README.md file and in the examples directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(args ...Filter) string

This is like calling New().Build(). Returns a JSON string that can be used as the object filter.

Types

type Filter

type Filter struct {
	Path string
	Op   string
	Opts map[string]interface{}
	Val  interface{}
}

func Path

func Path(path string, val ...interface{}) Filter

This creates a new Filter. The path is a dot-delimited path down to the attribute this filter is for. The second value parameter is optional.

func (Filter) Build

func (f Filter) Build() string

Builds the filter string in JSON format

func (Filter) Contains

func (f Filter) Contains(val interface{}) Filter

Set this filter to test if property contains the value

func (Filter) Date

func (f Filter) Date(date string) Filter

Set this filter to test if property has the exact date as the value.

func (Filter) DateAfter

func (f Filter) DateAfter(date string) Filter

Set this filter to test if property has a date after the value.

func (Filter) DateBefore

func (f Filter) DateBefore(date string) Filter

Set this filter to test if property has a date before the value.

func (Filter) DateBetween

func (f Filter) DateBetween(start string, end string) Filter

Set this filter to test if property has a date between the values.

func (Filter) DaysPast

func (f Filter) DaysPast(val interface{}) Filter

Set this filter to test if property has a date older than the value in days.

func (Filter) EndsWith

func (f Filter) EndsWith(val interface{}) Filter

Set this filter to test if property ends with the value

func (Filter) Eq

func (f Filter) Eq(val interface{}) Filter

Set this filter to test if property is equal to the value

func (Filter) GreaterThan

func (f Filter) GreaterThan(val interface{}) Filter

Set this filter to test if property is greater than value

func (Filter) GreaterThanOrEqual

func (f Filter) GreaterThanOrEqual(val interface{}) Filter

Set this filter to test if property is greater than or equal to value

func (Filter) In

func (f Filter) In(args ...interface{}) Filter

Set this filter to test if property is one of the values in args.

func (Filter) IsNull

func (f Filter) IsNull() Filter

Set this filter to test if property is null

func (Filter) LessThan

func (f Filter) LessThan(val interface{}) Filter

Set this filter to test if property is less than value

func (Filter) LessThanOrEqual

func (f Filter) LessThanOrEqual(val interface{}) Filter

Set this filter to test if property is less than or equal to the value

func (Filter) Like

func (f Filter) Like(val interface{}) Filter

Set this filter to test if property is like the value

func (Filter) NotContains

func (f Filter) NotContains(val interface{}) Filter

Set this filter to test if property does not contain the value

func (Filter) NotEndsWith

func (f Filter) NotEndsWith(val interface{}) Filter

Set this filter to test if property does not end with the value

func (Filter) NotEq

func (f Filter) NotEq(val interface{}) Filter

Set this filter to test if property is not equal to the value

func (Filter) NotLike

func (f Filter) NotLike(val interface{}) Filter

Set this filter to test if property is unlike value

func (Filter) NotNull

func (f Filter) NotNull() Filter

Set this filter to test if property is not null

func (Filter) NotStartsWith

func (f Filter) NotStartsWith(val interface{}) Filter

Set this filter to test if property does not start with the value

func (Filter) Opt

func (f Filter) Opt(name string, value interface{}) Filter

Add options to the filter. Can be chained for multiple options.

func (Filter) StartsWith

func (f Filter) StartsWith(val interface{}) Filter

Set this filter to test if property starts with the value

type Filters

type Filters []Filter

func New

func New(args ...Filter) Filters

Returns an array of Filters that you can later call .Build() on.

func (Filters) Build

func (fs Filters) Build() string

Builds the filter string in JSON format

Jump to

Keyboard shortcuts

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