gobinder

package module
v0.0.0-...-5e70832 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

README

gobinder

requires context with "log" set with Debugf, Infof, and Errorf

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEBUG_MUTATION bool = true
View Source
var ENV = envy.Get("GO_ENV", "development")
View Source
var SetCreatedUpdatedTimeOnSave bool = true

Functions

func BindFieldValue

func BindFieldValue(ctx context.Context, name string, pField *reflect.Value, value reflect.Value) error

https://play.golang.org/p/PmRkzehLlfa - test field.kind() vs field.type()

func FieldByTagName

func FieldByTagName(value interface{}, tagName string, tagValue string) (reflect.StructField, error)

func FieldByTagNameViaType

func FieldByTagNameViaType(structType reflect.Type, tagName string, tagValue string) (reflect.StructField, error)

func ForEachField

func ForEachField(st interface{}, block ForEachBlock) error

func IsSlicesOfStruct

func IsSlicesOfStruct(slices interface{}) bool

@return true if parameter is []struct, and not []time.Time

func IsStructOrIsSlicesOfStruct

func IsStructOrIsSlicesOfStruct(value interface{}) bool

func ParseISODateTime

func ParseISODateTime(val string) (time.Time, error)

func SetupLogging

func SetupLogging() *zap.SugaredLogger

Types

type BaseModel

type BaseModel interface {
	Init()
}

type ForEachBlock

type ForEachBlock func(int, *reflect.Value, reflect.StructField) error

type ModelBinder

type ModelBinder struct {
	Changes  map[string][]interface{} //[0: old, 1: new]
	ModelNew *bool

	Context context.Context
	// contains filtered or unexported fields
}

func (*ModelBinder) Changed

func (this *ModelBinder) Changed(name string) bool

func (*ModelBinder) Dirty

func (this *ModelBinder) Dirty() bool

func (*ModelBinder) Get

func (this *ModelBinder) Get(name string) interface{}

func (*ModelBinder) IsNew

func (this *ModelBinder) IsNew() bool

func (*ModelBinder) Model

func (this *ModelBinder) Model() interface{}

func (*ModelBinder) OldValue

func (this *ModelBinder) OldValue(name string) interface{}

func (*ModelBinder) ResetChange

func (this *ModelBinder) ResetChange(name string)

func (*ModelBinder) ResetRelation

func (this *ModelBinder) ResetRelation() error

func (*ModelBinder) Set

func (this *ModelBinder) Set(name string, value interface{}, markChanged bool) error

func (*ModelBinder) SetValue

func (this *ModelBinder) SetValue(name string, value reflect.Value, markChanged bool) error

func (*ModelBinder) Sets

func (this *ModelBinder) Sets(values map[string]interface{}, markChanged bool) error

func (*ModelBinder) SetsFromJSON

func (this *ModelBinder) SetsFromJSON(values map[string]interface{}, markChanged bool) error

type ParamBinderOption

type ParamBinderOption struct {
	Permit []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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