Skip to content

Collect generics into composed interface #61

@shaunc

Description

@shaunc

I would like

//go:generate genny -in=$GOFILE -out=$GOFILE_gen gen "Datatype=string,int"

type Datatype generic.Type
type GetterDatatype interface {
  GetDataType(column string) (DataType, err)
}
type HasGetters interface {
  GetterDatatype
} 

To expand into

type GetterInt interface {
  GetInt(column string) (int, err)
}
type GetterString interface {
  GetString(column string) (string, err)
}
type HasGetters interface {
  GetterInt
  GetterString
}

But, of course, it doesn't. Is this a worthy enhancement? Is there a workaround to define HasGetters (other than knowing ahead of time what the datatypes are)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions