Skip to content

methods #14

Description

@anpic

@elgopher

Is your feature request related to a problem? Please describe.
please add support methods too

type A struct {
	a string
}

func (a A) goString() string {
    	return a.a
}

func (a A) String() string {
    	return a.a
}

func (a A) Do(some string) string {
    	return some
}

m mapify.Mapper
if v, err := m.MapAny(A{ a: "a" }); err == nil {
	fmt.Println(v)    // map[]
}

Describe the solution you'd like

m mapify.Mapper
m.PrivateMethods = true
m.PublicMethods = true
// m.Methods = true // for both
m.ExecMethods = true
if v, err := m.MapAny(A{ a: "a" }); err == nil {
	fmt.Println(v)    // map[String:a,goString:a]
}
m mapify.Mapper
m.PrivateMethods = true
m.PublicMethods = true
m.ExecMethods = false
if v, err := m.MapAny(A{ a: "a" }); err == nil {
	fmt.Println(v)    // map[Do:func(string) string,String:func() string,goString:func() string]
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions