Documentation ¶
Overview ¶
Package domain contains domain entities and core validation rules.
Index ¶
Constants ¶
View Source
const ( ContentLibrary = "library" ContentLink = "link" ContentVideo = "video" )
Common content types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Meta ¶
type Meta struct { // Name represents a unique name/identifier for the object. Name string `json:"name" bson:"name"` // Tags can contain additional metadata about the object. Tags []string `json:"tags,omitempty" bson:"tags"` // CreateAt represents the time at which this object was created. CreatedAt time.Time `json:"created_at,omitempty" bson:"created_at"` // UpdatedAt represents the time at which this object was last // modified. UpdatedAt time.Time `json:"updated_at,omitempty" bson:"updated_at"` }
Meta represents metadata about different entities.
func (*Meta) SetDefaults ¶
func (meta *Meta) SetDefaults()
SetDefaults sets sensible defaults on meta.
type Post ¶
type Post struct { Meta `json:",inline" bson:",inline"` // Type should state the type of the content. (e.g., library, // video, link etc.) Type string `json:"type" bson:"type"` // Body should contain the actual content according to the Type // specified. (e.g. github.com/spy16/parens when Type=link) Body string `json:"body" bson:"body"` // Owner represents the name of the user who created the post. Owner string `json:"owner" bson:"owner"` }
Post represents an article, link, video etc.
type User ¶
type User struct { Meta `json:",inline,omitempty" bson:",inline"` // Email should contain a valid email of the user. Email string `json:"email,omitempty" bson:"email"` // Secret represents the user secret. Secret string `json:"secret,omitempty" bson:"secret"` }
User represents information about registered users.
func (User) CheckSecret ¶
CheckSecret compares the cleartext password with the hash.
func (*User) HashSecret ¶
HashSecret creates bcrypt hash of the password.
Click to show internal directories.
Click to hide internal directories.