support

package module
v0.0.0-...-f198145 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: MIT Imports: 8 Imported by: 3

README

codecov

Support

This repository contains helper methods and structs that can help you build your application.

License

Confetti is open-sourced software licensed under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CanNotAppendValueError = errors.New("")
View Source
var CanNotCreateMapError = errors.New("can not create map")
View Source
var CanNotFoundValueError = errors.New("can not found value")
View Source
var InvalidCollectionKeyError = errors.New("")

Functions

func Dump

func Dump(expression ...interface{})

func Kind

func Kind(element interface{}) reflect.Kind

func MimeByExtension

func MimeByExtension(filename string) (string, bool)

func Name

func Name(element interface{}) string

func Package

func Package(element interface{}) string

Types

type Collection

type Collection []Value

func NewCollection

func NewCollection(items ...interface{}) Collection

func (Collection) Contains

func (c Collection) Contains(search interface{}) bool

Determine if an item exists in the collection by a string

func (Collection) Empty

func (c Collection) Empty() bool

func (Collection) First

func (c Collection) First() Value

func (Collection) Get

func (c Collection) Get(key string) Value

func (Collection) GetE

func (c Collection) GetE(key string) (Value, error)

func (Collection) Len

func (c Collection) Len() int

The len method returns the length of the collection

func (Collection) Only

func (c Collection) Only(keys ...string) Collection

func (Collection) OnlyE

func (c Collection) OnlyE(expectedKeys ...string) (Collection, error)

func (Collection) Push

func (c Collection) Push(item interface{}) Collection

func (Collection) Raw

func (c Collection) Raw() interface{}

func (Collection) Reverse

func (c Collection) Reverse() Collection

func (Collection) SetE

func (c Collection) SetE(key string, value interface{}) (Collection, error)

type File

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

func NewFile

func NewFile(source multipart.File, header *multipart.FileHeader) File

func (File) Body

func (f File) Body() string

func (File) Close

func (f File) Close() error

func (File) Extension

func (f File) Extension() string

func (File) Header

func (f File) Header() *multipart.FileHeader

func (File) Name

func (f File) Name() interface{}

func (File) Source

func (f File) Source() multipart.File

type Files

type Files []File

type Key

type Key = string

func GetSearchableKeys

func GetSearchableKeys(originKeys []string, value Value) []Key

convert keys with an asterisk to usable keys

func GetSearchableKeysByOneKey

func GetSearchableKeysByOneKey(originKey string, input Value) []Key

convert key with an asterisk to usable keys

func PrefixKey

func PrefixKey(searchablePrefix, key string) Key

type Map

type Map map[string]Value

func NewMap

func NewMap(itemsRange ...interface{}) Map

func NewMapE

func NewMapE(itemsRange ...interface{}) (Map, error)

func (Map) Collection

func (m Map) Collection() Collection

func (Map) Copy

func (m Map) Copy() Map

Copy generates a new struct with the same data as the old struct

func (Map) Delete

func (m Map) Delete(key string)

Delete deletes the values associated with key.

func (Map) Empty

func (m Map) Empty() bool

func (Map) Except

func (m Map) Except(keys ...string) Map

func (Map) Filled

func (m Map) Filled(keys ...string) bool

func (Map) First

func (m Map) First() Value

func (Map) Get

func (m Map) Get(key string) Value

func (Map) GetE

func (m Map) GetE(key string) (Value, error)

GetE gets the first value associated with the given key. If there are no values associated with the key, GetE returns nil. To access multiple values, use GetCollection or Collection.

func (Map) Has

func (m Map) Has(keys ...string) bool

func (Map) HasAny

func (m Map) HasAny(keys ...string) bool

func (Map) Merge

func (m Map) Merge(maps ...Map) Map

func (Map) Missing

func (m Map) Missing(keys ...string) bool

func (Map) Only

func (m Map) Only(keys ...string) Map

func (Map) OnlyE

func (m Map) OnlyE(originKeys ...string) (Map, error)

func (Map) Push

func (m Map) Push(key string, input interface{}) Map

Push adds the value to key. It appends to any existing values associated with key. If the value is in collection, push the value to the collection.

func (Map) Raw

func (m Map) Raw() interface{}

func (Map) SetE

func (m Map) SetE(key string, input interface{}) (Map, error)

SetE sets the key to value by dot notation

type Value

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

func NewValue

func NewValue(val interface{}, preErr ...error) Value

func (Value) Bool

func (v Value) Bool() bool

func (Value) Collection

func (v Value) Collection() Collection

A value can contain a collection.

func (Value) Empty

func (v Value) Empty() bool

func (Value) Error

func (v Value) Error() error

func (Value) Filled

func (v Value) Filled() bool

func (Value) Float

func (v Value) Float() float64

func (Value) FloatE

func (v Value) FloatE() (float64, error)

func (Value) Get

func (v Value) Get(key string) Value

func (Value) GetE

func (v Value) GetE(key string) (Value, error)

func (Value) Int

func (v Value) Int() int

func (Value) IntE

func (v Value) IntE() (int, error)

func (Value) Map

func (v Value) Map() Map

func (Value) MapE

func (v Value) MapE() (Map, error)

func (Value) Only

func (v Value) Only(keys ...string) Value

func (Value) OnlyE

func (v Value) OnlyE(keys ...string) (Value, error)

func (Value) Raw

func (v Value) Raw() interface{}

func (Value) Set

func (v Value) Set(key string, input interface{}) Value

func (Value) SetE

func (v Value) SetE(key string, input interface{}) (Value, error)

func (Value) Source

func (v Value) Source() interface{}

func (Value) Split

func (v Value) Split(separator string) Collection

Split slices Value into all substrings separated by separator and returns a slice of the strings between those separators.

If Value does not contain separator and separator is not empty, Split returns a slice of length 1 whose only element is Value.

func (Value) String

func (v Value) String() string

func (Value) StringE

func (v Value) StringE() (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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