Supporting your object-oriented programming and, providing extended objects inheriting from built-in types.
Extended objects are immutable, and implemented methods are non-destructive. They implement typecast methods and several utility methods, reducing the need to define value objects of the underlying type.
Also, list is a defined type of slice that uses generics and implements a set of methods based on Ruby Array Class.
go get -u github.com/verniyyy/extend-types-go
type MyString struct{ types.Str }
func NewMyString(s string) MyString {
return MyString{types.NewStr(s)}
}
func main() {
myString := NewMyString("foo")
_ = myString.Value() // get raw value
_ = myString.Validate() // returning nil
}
This was originally an implementation for myself, but I am currently in the process of experimentally releasing it as OSS. I am a beginner in OSS development, and there may be various insufficient elements. So contributions are most welcome.
Please report issues using the Issues tab at the top of this page.
If you modify the code please submit a pull request for review.