Documentation
¶
Overview ¶
Package models provides the data models for the forum service.
Package models provides the data models for the forum service.
Package models provides the data models for the forum service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Forum ¶
type Forum struct { Id uint64 `json:"id" gorm:"primaryKey"` UserId uint64 `json:"user_id" gorm:"not null"` Title string `json:"title" gorm:"<-;unique;not null"` Description string `json:"description" gorm:"not null"` Threads []*Thread `json:"threads,omitempty"` CreatedAt int64 `json:"created_at" gorm:"autoCreateTime"` UpdatedAt int64 `json:"updated_at" gorm:"autoUpdateTime"` }
Forum is the data model for a Forum.
func (*Forum) FromProtoBuffer ¶
FromProtoBuffer takes a pb forum and 'loads' the current forum with the details.
func (*Forum) ToProtoBuffer ¶
ToProtoBuffer returns a protocol buffers version of the Forum.
type Post ¶
type Post struct { Id uint64 `json:"id" gorm:"primaryKey"` ThreadId uint64 `json:"thread_id" gorm:"not null"` UserId uint64 `json:"user_id" gorm:"not null"` Msg string `json:"msg" gorm:"not null"` CreatedAt int64 `json:"created_at" gorm:"autoCreateTime"` UpdatedAt int64 `json:"updated_at" gorm:"autoUpdateTime"` }
Post is the data model for a Post.
func (*Post) FromProtoBuffer ¶
FromProtoBuffer takes a pb post and 'loads' the current post with the details.
func (*Post) ToProtoBuffer ¶
ToProtoBuffer returns a protocol buffers version of the Post.
type Thread ¶
type Thread struct { Id uint64 `json:"id,omitempty" gorm:"primaryKey"` ForumId uint64 `json:"forum_id" gorm:"not null"` UserId uint64 `json:"user_id" gorm:"not null"` Title string `json:"title" gorm:"not null"` Msg string `json:"msg" gorm:"not null"` Posts []*Post `json:"posts,omitempty"` CreatedAt int64 `json:"created_at" gorm:"autoCreateTime"` UpdatedAt int64 `json:"updated_at" gorm:"autoUpdateTime"` }
Thread is the data model for a Thread.
func (*Thread) FromProtoBuffer ¶
FromProtoBuffer takes a pb thread and 'loads' the current thread with the details.
func (*Thread) ToProtoBuffer ¶
ToProtoBuffer returns a protocol buffers version of the Thread.