models

package
v0.0.0-...-91b8838 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2022 License: BSD-3-Clause Imports: 1 Imported by: 0

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

func (f *Forum) FromProtoBuffer(forum *pb.Forum)

FromProtoBuffer takes a pb forum and 'loads' the current forum with the details.

func (*Forum) ToProtoBuffer

func (f *Forum) ToProtoBuffer() *pb.Forum

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

func (p *Post) FromProtoBuffer(post *pb.Post)

FromProtoBuffer takes a pb post and 'loads' the current post with the details.

func (*Post) ToProtoBuffer

func (p *Post) ToProtoBuffer() *pb.Post

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

func (t *Thread) FromProtoBuffer(thread *pb.Thread)

FromProtoBuffer takes a pb thread and 'loads' the current thread with the details.

func (*Thread) ToProtoBuffer

func (t *Thread) ToProtoBuffer() *pb.Thread

ToProtoBuffer returns a protocol buffers version of the Thread.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL