Last active
July 10, 2019 18:16
-
-
Save l0gicgate/85091e2ab7ebb369ed6088b632af1488 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type IGenericType interface { | |
GetName() string | |
} | |
type GenericTypeRepository struct { | |
NativeType IGenericType | |
} | |
func (r *GenericTypeRepository) FindAll() (*[]IGenericType, error) { | |
var types []r.NativeType | |
// How can I make this var be whatever type is specified when instantiating the GenericTypeRepository | |
} | |
// Type A implements IGenericType | |
type A struct { | |
Name string | |
} | |
func (a *A) GetName() string { | |
return a.Name | |
} | |
// Instantiation of GenericTypeRepository | |
repo := &GenericTypeRepository{ NativeType: A } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment