gg_structs

package
v0.2.45 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

README

Structs

Struct builder using reflection

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TypeFromText added in v0.2.29

func TypeFromText(sType string) (t reflect.Type, v interface{})

Types

type StructBuilder

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

func NewBuilder

func NewBuilder() *StructBuilder

func (*StructBuilder) AddFieldByStringType

func (instance *StructBuilder) AddFieldByStringType(name, tag string, sType string) *StructBuilder

AddFieldByStringType add a field using its string type name with a default value

func (*StructBuilder) AddFieldByValue

func (instance *StructBuilder) AddFieldByValue(name, tag string, value interface{}) *StructBuilder

func (*StructBuilder) Descriptor added in v0.2.29

func (instance *StructBuilder) Descriptor() (response map[string]string)

func (*StructBuilder) Elem

func (instance *StructBuilder) Elem() reflect.Value

Elem return element you can use to add fields: ex. elem.Field(0).SetInt(1234)

func (*StructBuilder) EnableAutoTagJson

func (instance *StructBuilder) EnableAutoTagJson(value bool) *StructBuilder

func (*StructBuilder) Interface

func (instance *StructBuilder) Interface() interface{}

func (*StructBuilder) Json

func (instance *StructBuilder) Json() string

func (*StructBuilder) Set

func (instance *StructBuilder) Set(name string, value interface{}) *StructBuilder

type StructHelper

type StructHelper struct {
}
var Structs *StructHelper

func (*StructHelper) NewBuilder

func (instance *StructHelper) NewBuilder() *StructBuilder

Jump to

Keyboard shortcuts

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