xargs

package
v1.2.13 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidID = errors.New("invalid id")
View Source
var ErrInvalidUpdates = errors.New("invalid updates")

Functions

func AddBindErrors

func AddBindErrors(c *xin.Context, err error, ns string)

AddBindErrors translate bind or validate errors and add it to context

func E

func E(c *xin.Context) xin.H

func FormatBindErrors

func FormatBindErrors(locale string, err error, ns string) error

FormatBindErrors translate bind or validate errors and merge it to a new error

func InvalidFieldError

func InvalidFieldError(c *xin.Context, ns, field string) error

func InvalidIDError

func InvalidIDError(c *xin.Context) error

func InvalidRequestError

func InvalidRequestError(c *xin.Context) error

func NextKeyword

func NextKeyword(s string) (string, string, bool)

func TranslateBindErrors

func TranslateBindErrors(locale string, err error, ns string, tf func(error))

TranslateBindErrors translate bind or validate errors FieldBindErrors:

  1. {xxx}.error.{field}
  2. error.param.invalid

ValidationErrors:

  1. {xxx}.error.{field}.{tag}
  2. {xxx}.error.param.{tag}
  3. error.param.{tag}
  4. error.param.invalid

Types

type DateRangeArg

type DateRangeArg struct {
	DateMin time.Time `json:"date_min,omitempty" form:"date_min,strip"`
	DateMax time.Time `json:"date_max,omitempty" form:"date_max,strip" validate:"omitempty,gtefield=DateMin"`
}

func (*DateRangeArg) Normalize

func (dra *DateRangeArg) Normalize()

type Decimals

type Decimals struct {
	// contains filtered or unexported fields
}

func ParseDecimals

func ParseDecimals(val string) (ds Decimals, err error)

func ParseUdecimals

func ParseUdecimals(val string) (ds Decimals, err error)

func (Decimals) Contains

func (ds Decimals) Contains(n float64) bool

func (Decimals) IsEmpty

func (ds Decimals) IsEmpty() bool

func (*Decimals) Parse

func (ds *Decimals) Parse(val string) (err error)

func (Decimals) String

func (ds Decimals) String() string

type IDArg

type IDArg struct {
	ID string `json:"id,omitempty" form:"id,strip"`
	// contains filtered or unexported fields
}

func (*IDArg) Bind

func (ida *IDArg) Bind(c *xin.Context) error

func (*IDArg) IDs

func (ida *IDArg) IDs() []int64

func (*IDArg) IsValid added in v1.2.13

func (ida *IDArg) IsValid() bool

func (*IDArg) ParseID

func (ida *IDArg) ParseID() error

func (*IDArg) String

func (ida *IDArg) String() string

type Integers

type Integers struct {
	// contains filtered or unexported fields
}

func ParseIntegers

func ParseIntegers(val string) (ns Integers, err error)

func ParseUintegers

func ParseUintegers(val string) (ns Integers, err error)

func (Integers) Contains

func (ns Integers) Contains(n int64) bool

func (Integers) IsEmpty

func (ns Integers) IsEmpty() bool

func (*Integers) Parse

func (ns *Integers) Parse(val string) (err error)

func (Integers) String

func (ns Integers) String() string

type Keywords

type Keywords []string

func ParseKeywords

func ParseKeywords(val string) (keys Keywords)

func (Keywords) Contains

func (ks Keywords) Contains(v string) bool

func (Keywords) ContainsAny

func (ks Keywords) ContainsAny(vs ...string) bool

func (Keywords) String

func (ks Keywords) String() string

type PKArg

type PKArg struct {
	ID string `json:"id,omitempty" form:"id,strip"`
	// contains filtered or unexported fields
}

func (*PKArg) Bind

func (pka *PKArg) Bind(c *xin.Context) error

func (*PKArg) IsValid added in v1.2.13

func (pka *PKArg) IsValid() bool

func (*PKArg) PKs

func (pka *PKArg) PKs() []string

func (*PKArg) ParseID

func (pka *PKArg) ParseID() error

func (*PKArg) String

func (pka *PKArg) String() string

type ParamError

type ParamError struct {
	Param   string `json:"param,omitempty"`
	Label   string `json:"label,omitempty"`
	Message string `json:"message,omitempty"`
}

func (*ParamError) Error

func (pe *ParamError) Error() string

type Sorter added in v1.2.9

type Sorter struct {
	Col string `json:"c,omitempty" form:"c"`
	Dir string `json:"d,omitempty" form:"d,lower"`
}

func (*Sorter) IsAsc added in v1.2.9

func (s *Sorter) IsAsc() bool

func (*Sorter) IsDesc added in v1.2.9

func (s *Sorter) IsDesc() bool

func (*Sorter) Normalize added in v1.2.9

func (s *Sorter) Normalize(columns ...string)

func (*Sorter) String added in v1.2.9

func (s *Sorter) String() string

type TimeRangeArg

type TimeRangeArg struct {
	TimeMin time.Time `json:"time_min,omitempty" form:"time_min,strip"`
	TimeMax time.Time `json:"time_max,omitempty" form:"time_max,strip" validate:"omitempty,gtefield=TimeMin"`
}

type Wildcards added in v1.2.7

type Wildcards []string

func ParseWildcards added in v1.2.7

func ParseWildcards(val string) Wildcards

func (Wildcards) Match added in v1.2.7

func (ws Wildcards) Match(v string) bool

func (Wildcards) MatchAny added in v1.2.7

func (ws Wildcards) MatchAny(vs ...string) bool

func (Wildcards) StartsWith added in v1.2.8

func (ws Wildcards) StartsWith(v string) bool

func (Wildcards) StartsWithAny added in v1.2.8

func (ws Wildcards) StartsWithAny(vs ...string) bool

func (Wildcards) String added in v1.2.7

func (ws Wildcards) String() string

Jump to

Keyboard shortcuts

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