github.com/alloyzeus/go-azfl@v0.0.0-20231220071816-9740126a2d07/azcore/value_object.go (about)

     1  package azcore
     2  
     3  import "github.com/alloyzeus/go-azfl/azob"
     4  
     5  // A ValueObject is a small object that represents a simple entity whose
     6  // equality is not based on identity, i.e., two value objects are equal when
     7  // they have the same value, not necessarily being the same object.
     8  type ValueObject interface {
     9  	//TODO: we should have Clone method contract here, but it requires
    10  	// covariant support which won't happen
    11  	// https://github.com/golang/go/issues/30602
    12  }
    13  
    14  // ValueObjectAssert is tool to assert that a struct conforms the
    15  // characteristic of a value-object.
    16  //
    17  // To use:
    18  //
    19  //     var _ = ValueObjectAssert[MyStruct] = MyStruct{}
    20  //
    21  type ValueObjectAssert[T any] interface {
    22  	azob.CloneableAssert[T]
    23  }