filter

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2018 License: MIT Imports: 3 Imported by: 13

README

Filter

GoDoc Go Report Card

package filter provide filter, sanitize, convert golang data.

GoDoc

Usage

intVal, err := filter.Int("20")
strArr := filter.Str2Array("a,b, c", ",")

License

MIT

Documentation

Overview

Package filter provide data filter, sanitize, convert

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetByPath

func GetByPath(key string, mp map[string]interface{}) (val interface{}, ok bool)

GetByPath get value from a map[string]interface{}. eg "top" "top.sub"

func Int

func Int(str string) (int, error)

Int convert

func MustFloat

func MustFloat(str string) float64

MustFloat convert

func MustInt

func MustInt(str string) int

MustInt convert

func MustUint

func MustUint(str string) uint64

MustUint convert

func Str2Array

func Str2Array(str string, sep ...string) []string

Str2Array split string to array.

func ToFloat

func ToFloat(str string) (float64, error)

ToFloat convert

func ToInt

func ToInt(str string) (int, error)

ToInt convert

func ToInt64

func ToInt64(str string) (int64, error)

ToInt64 convert

func ToUint

func ToUint(str string) (uint64, error)

ToUint convert

func Trim

func Trim(str string, cutSet ...string) string

Trim string

func Uint

func Uint(str string) (uint64, error)

Uint convert

Types

type Filtration

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

Filtration definition. Sanitization Sanitizing Sanitize

func (*Filtration) Get

func (f *Filtration) Get(key string) (interface{}, bool)

Get value by key

func (*Filtration) Set

func (f *Filtration) Set(field string, val interface{}) error

Set value by key

type String

type String string

String definition.

func (String) Bool

func (s String) Bool() bool

Bool convert.

func (String) CanInt

func (s String) CanInt() bool

CanInt convert.

func (String) Float

func (s String) Float() float64

Float convert. to float 64

func (String) Int

func (s String) Int() (val int)

Int convert.

func (String) Int64

func (s String) Int64() int64

Int64 convert.

func (String) Split

func (s String) Split(sep string) (ss []string)

Split string to slice

func (String) String

func (s String) String() string

String get

func (String) Trimmed

func (s String) Trimmed() string

Trimmed string

func (String) Uint

func (s String) Uint() uint

Uint convert.

Jump to

Keyboard shortcuts

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