Skip to content
/ mirror Public

mirror implements run-time 'mirror' reflection in Go, allowing struct fields to be passed to functions by value.

License

Notifications You must be signed in to change notification settings

qlova/mirror

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mirror

Mirror is a small Go package that allows passing struct fields by value with the use of a mirror.Type

var get mirror.Type
var StreetAddress struct {
    Number int
    Street string

    Postcode int
}

//Reflect the value onto the mirror.
get.Reflect(&StreetAddress)

//Inspect fields by struct-value.
get.Field(StreetAddress.Number).Name    //"Number"
get.Field(StreetAddress.Postcode).Name  //"Postcode"
get.Field(StreetAddress.Street).Name    //"Street"

About

mirror implements run-time 'mirror' reflection in Go, allowing struct fields to be passed to functions by value.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages