cmp

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparative

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

Comparative represents a compare.

func New

func New(key string, comparison Comparison, value string, kind Kind) *Comparative

New creates a Comparative.

func NewDate

func NewDate(key string, comparison Comparison, value time.Time) *Comparative

NewDate creates a Comparative from time.Time.

func NewInt64

func NewInt64(key string, comparison Comparison, value int64) *Comparative

NewInt64 creates a Comparative from int64.

func NewString

func NewString(key string, comparison Comparison, value string) *Comparative

NewString creates a Comparative from string.

func (*Comparative) Comparison

func (c *Comparative) Comparison() Comparison

Comparison returns the Comparison.

func (*Comparative) Key

func (c *Comparative) Key() string

Key returns the key.

func (*Comparative) Kind

func (c *Comparative) Kind() Kind

Kind returns the Kind.

func (*Comparative) MustValue

func (c *Comparative) MustValue() interface{}

MustValue returns the value, panic if failed.

func (*Comparative) RawValue

func (c *Comparative) RawValue() string

RawValue returns the raw value in string.

func (*Comparative) SetComparison

func (c *Comparative) SetComparison(comparison Comparison)

func (*Comparative) SetKind

func (c *Comparative) SetKind(k Kind)

SetKind sets the Kind.

func (*Comparative) String

func (c *Comparative) String() string

func (*Comparative) Value

func (c *Comparative) Value() (interface{}, error)

Value returns auto-converted value.

type Comparison

type Comparison uint8

Comparison represents the comparisons.

const (
	Ceq  Comparison // ==
	Cne             // <>
	Cgt             // >
	Cgte            // >=
	Clt             // <
	Clte            // <=
)

NOTICE: DO NOT change orders of following constants!!!

func ParseComparison

func ParseComparison(s string) (c Comparison, ok bool)

ParseComparison parses the Comparison from a string.

func (Comparison) String

func (c Comparison) String() string

func (Comparison) WriteTo

func (c Comparison) WriteTo(w io.Writer) (int64, error)

type Kind

type Kind uint8
const (
	Kint    Kind // INT
	Kstring      // STRING
	Kdate        // DATE
)

func (Kind) String

func (k Kind) String() string

Jump to

Keyboard shortcuts

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