Documentation ¶
Overview ¶
Package model contains all Model structures and helpers which are permanently stored by a store.Store.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePostID ¶
GeneratePostID creates a new post ID based on the post's subject, comment and creation time
func HashPassword ¶
HashPassword hashes a password using bcrypt with default cost.
Types ¶
type Ban ¶
type Ban struct { ID string `json:"id" bson:"_id"` IP string `json:"ip" bson:"ip"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` Duration time.Duration `json:"duration" bson:"duration"` Reason string `json:"reason" bson:"reason"` Mod string `json:"mod" bson:"mod"` }
Ban is a user's ban
type Board ¶
type Board struct { URI string `json:"uri" bson:"_id" validate:"board"` Name string `json:"title" validate:"required"` Description string `json:"description,omitempty"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` Hidden bool `json:"hidden,omitempty" bson:"hidden"` }
Board is a board
type Media ¶
type Media struct { MIME string `json:"mime" bson:"MIME"` Name string `json:"name" bson:"name"` Size int64 `json:"size" bson:"size"` Storage string `json:"-" bson:"storage"` StorageID string `json:"-" bson:"storageId"` ThumbnailStorageID string `json:"-" bson:"thumbStorageId"` URL string `json:"url" bson:"url"` ThumbnailURL string `json:"thumbnailUrl" bson:"thumbnailUrl"` }
Media is a comment's media
type Post ¶
type Post struct { ID string `json:"id" bson:"_id" validate:"required"` Parent string `json:"parent,omitempty" bson:"parent,omitempty"` Board string `json:"board,omitempty" bson:"board,omitempty" validate:"board,required"` Name string `json:"name" bson:"name" validate:"max=16"` Comment string `json:"comment" bson:"comment" validate:"required,min=4,max=5120"` Subject string `json:"subject,omitempty" bson:"subject,omitempty" validate:"max=48"` Deleted bool `json:"deleted,omitempty" bson:"deleted"` IP string `json:"address,omitempty" bson:"address"` Locked bool `json:"locked,omitempty" bson:"locked"` Hidden bool `json:"hidden,omitempty" hidden:"locked"` Medias []*Media `json:"medias" bson:"medias"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` LastBumpedAt *time.Time `json:"lastBumpedAt,omitempty" bson:"lastBumpedAt"` }
Post is a comment
type Thread ¶
type Thread struct { Post `json:",inline" bson:",inline"` Replies []*Post `json:"replies" bson:"replies"` }
Thread is a structure holding a collection of posts, where one of them is the common parent (OP) and the others are replies
type User ¶
type User struct { Username string `json:"username" bson:"_id" validate:"required,min=4,max=32"` Role string `json:"role" bson:"role" validate:"required"` HashedPassword []byte `json:"-" bson:"hashedPassword" validate:"required"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` LastModifiedAt time.Time `json:"modifiedAt" bson:"modifiedAt"` }
User is a user
func (*User) SetPassword ¶
SetPassword sets an user password after hashing it.
func (*User) VerifyPassword ¶
VerifyPassword verifies if a user has the correct password
Click to show internal directories.
Click to hide internal directories.