Documentation ¶
Index ¶
- Variables
- type AggregateType
- type Description
- type Email
- type FamilyName
- type GivenName
- type Identifier
- type LongName
- type Password
- type ShortCode
- type ShortName
- type Timestamp
- func (v Timestamp) Equals(value Value) bool
- func (v Timestamp) MarshalJSON() ([]byte, error)
- func (v Timestamp) MarshalText() ([]byte, error)
- func (v Timestamp) String() string
- func (v Timestamp) Time() time.Time
- func (v Timestamp) Unix() int64
- func (v *Timestamp) UnmarshalJSON(b []byte) error
- func (v *Timestamp) UnmarshalText(b []byte) error
- type URL
- type Username
- type Value
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidEmail = errors.New("not a valid email address")
)
EmailAddress errors
var (
ErrInvalidURL = errors.New("not a valid URL")
)
EmailAddress errors
Functions ¶
This section is empty.
Types ¶
type AggregateType ¶
type AggregateType struct {
// contains filtered or unexported fields
}
func NewAggregateType ¶
func NewAggregateType(value string) (AggregateType, error)
NewAggregateType creates a new valid aggregate type value object.
func (AggregateType) Equals ¶
func (v AggregateType) Equals(value Value) bool
Equals checks that two value objects are the same.
func (AggregateType) MarshalText ¶
func (v AggregateType) MarshalText() ([]byte, error)
MarshalText used to serialize the object
func (AggregateType) String ¶
func (v AggregateType) String() string
String implements the fmt.Stringer interface.
func (*AggregateType) UnmarshalText ¶
func (v *AggregateType) UnmarshalText(b []byte) error
UnmarshalText used to deserialize the object and returns an error if it's invalid.
type Description ¶
type Description struct {
// contains filtered or unexported fields
}
func NewDescription ¶
func NewDescription(value string) (Description, error)
NewDescription creates a new valid description object.
func (Description) Equals ¶
func (v Description) Equals(value Value) bool
Equals checks that two value objects are the same.
func (Description) MarshalText ¶
func (v Description) MarshalText() ([]byte, error)
MarshalText used to serialize the object
func (Description) String ¶
func (v Description) String() string
String implements the fmt.Stringer interface.
func (*Description) UnmarshalText ¶
func (v *Description) UnmarshalText(b []byte) error
UnmarshalText used to deserialize the object and returns an error if it's invalid.
type Email ¶
type Email struct {
// contains filtered or unexported fields
}
Email represents a valid email address.
func ZeroEmail ¶
func ZeroEmail() Email
ZeroEmail represents the zero value for an email value object.
func (Email) Equals ¶
Equals checks that two email addresses are the same.
Example ¶
package main import ( "fmt" "github.com/dasch-swiss/dasch-service-platform/shared/go/pkg/valueobject" ) func main() { a, _ := valueobject.NewEmail("joe@blogs.com") b, _ := valueobject.NewEmail("joe@blogs.com") fmt.Println(a.Equals(b)) }
Output: true
func (Email) MarshalText ¶
MarshalText used to serialize the object
func (Email) String ¶
String returns string representation of the email address.
Example ¶
package main import ( "fmt" "github.com/dasch-swiss/dasch-service-platform/shared/go/pkg/valueobject" ) func main() { e, _ := valueobject.NewEmail("joe@blogs.com") fmt.Println(e.String()) }
Output: joe@blogs.com
func (*Email) UnmarshalText ¶
UnmarshalText used to deserialize the object and returns an error if it's invalid.
type FamilyName ¶
type FamilyName struct {
// contains filtered or unexported fields
}
func NewFamilyName ¶
func NewFamilyName(value string) (FamilyName, error)
NewGivenName creates a new valid given name object.
func (FamilyName) Equals ¶
func (v FamilyName) Equals(value Value) bool
Equals checks that two value objects are the same.
func (FamilyName) MarshalText ¶
func (v FamilyName) MarshalText() ([]byte, error)
MarshalText used to serialize the object
func (FamilyName) String ¶
func (v FamilyName) String() string
String implements the fmt.Stringer interface.
func (*FamilyName) UnmarshalText ¶
func (v *FamilyName) UnmarshalText(b []byte) error
UnmarshalText used to deserialize the object and returns an error if it's invalid.
type GivenName ¶
type GivenName struct {
// contains filtered or unexported fields
}
func NewGivenName ¶
NewGivenName creates a new valid given name object.
func (GivenName) MarshalText ¶
MarshalText used to serialize the object
func (*GivenName) UnmarshalText ¶
UnmarshalText used to deserialize the object and returns an error if it's invalid.
type Identifier ¶
type Identifier struct {
// contains filtered or unexported fields
}
func IdentifierFromBytes ¶ added in v1.2.0
func IdentifierFromBytes(input []byte) (Identifier, error)
IdentifierFromBytes creates an identifier value object from the provided byte array
func NewIdentifier ¶
func NewIdentifier() (Identifier, error)
NewIdentifier creates a new identifier value object
func (Identifier) Equals ¶
func (v Identifier) Equals(value Value) bool
Equals tests for equality with another value object
func (Identifier) MarshalText ¶
func (v Identifier) MarshalText() ([]byte, error)
MarshalText used to serialize the object
func (Identifier) String ¶
func (v Identifier) String() string
String implements the fmt.Stringer interface.
func (Identifier) UUID ¶
func (v Identifier) UUID() uuid.UUID
AsUUID returns the UUID of the identifier.
func (*Identifier) UnmarshalText ¶
func (v *Identifier) UnmarshalText(b []byte) error
UnmarshalText used to deserialize the object and returns an error if it's invalid.
type LongName ¶
type LongName struct {
// contains filtered or unexported fields
}
func NewLongName ¶
NewLongName creates a new valid long name object.
func (LongName) MarshalText ¶
MarshalText used to serialize the object
func (*LongName) UnmarshalText ¶
UnmarshalText used to deserialize the object and returns an error if it's invalid.
type Password ¶
type Password struct {
// contains filtered or unexported fields
}
func NewPassword ¶
NewPassword creates a new valid password object.
func (Password) MarshalText ¶
MarshalText used to serialize the object
func (*Password) UnmarshalText ¶
UnmarshalText used to deserialize the object and returns an error if it's invalid.
type ShortCode ¶
type ShortCode struct {
// contains filtered or unexported fields
}
func NewShortCode ¶
NewShortCode creates a new valid short code object.
func (ShortCode) MarshalText ¶
MarshalText used to serialize the object
func (*ShortCode) UnmarshalText ¶
UnmarshalText used to deserialize the object and returns an error if it's invalid.
type ShortName ¶
type ShortName struct {
// contains filtered or unexported fields
}
func NewShortName ¶
NewShortName creates a new valid short name object.
func (ShortName) MarshalText ¶
MarshalText used to serialize the object
func (*ShortName) UnmarshalText ¶
UnmarshalText used to deserialize the object and returns an error if it's invalid.
type Timestamp ¶
type Timestamp struct {
// contains filtered or unexported fields
}
func NewTimestampFromUnix ¶
NewTimestampFromUnix creates a new timestamp value object for the supplied unix time in seconds.
func (Timestamp) MarshalJSON ¶
MarshalJSON used to serialize the object
func (Timestamp) MarshalText ¶
MarshalText used to serialize the object
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON used to deserialize the object and returns an error if it's invalid.
func (*Timestamp) UnmarshalText ¶
UnmarshalText used to deserialize the object and returns an error if it's invalid.
type URL ¶
type URL struct {
// contains filtered or unexported fields
}
URL represents a valid URL address.
type Username ¶
type Username struct {
// contains filtered or unexported fields
}
func NewUsername ¶
NewUsername creates a new valid username object.
func (Username) MarshalText ¶
MarshalText used to serialize the object
func (*Username) UnmarshalText ¶
UnmarshalText used to deserialize the object and returns an error if it's invalid.