Skip to content

Expose anonymous/embedded struct member. #30

@infogulch

Description

@infogulch

I see that last year support for embedded structs was added, but it doesn't enable the builder to create a type with embedded structs.

Something like this:

	type stitle struct{ Title string }
	type stext struct{ Text string }

	dstruct := dynamicstruct.NewStruct().
		AddField("", stitle{}, ``).
		AddField("", stext{}, ``).
		Build().
		New()

	type compare struct {
		stitle
		stext 
	}

	if dstruct != compare{} {
		fmt.Println("expected equal")
	}

Besides the general idea of creating a new struct, do you think this is a reasonable interface? In particular if name == "", then set anonymous: true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions