gateway

package
v0.0.0-...-ebc85b6 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IDsFromHex

func IDsFromHex(hexList []string) []primitive.ObjectID

IDsFromHex convert array of hex to mongoDB objectID

Types

type Post

type Post struct {
	ID           primitive.ObjectID `bson:"_id"`
	Name         string
	Avatar       string
	Body         string
	UpvoterIDs   map[string]bool `bson:"upvoterIDs"`
	DownvoterIDs map[string]bool `bson:"downvoterIDs"`
	ReplyCount   int             `bson:"replyCount"`
	Repost       []Post          `bson:"repost"`
	Room         []Room          `bson:"room"`
	RepostRoom   []Room          `bson:"repostRoom"`
}

Post extract model

func (*Post) Entity

func (m *Post) Entity() service.Post

Entity convert post to entity

type PostModel

type PostModel struct {
	ID           primitive.ObjectID `bson:"_id"`
	Name         string
	Avatar       string
	Body         string
	UpvoterIDs   map[string]bool    `bson:"upvoterIDs"`
	DownvoterIDs map[string]bool    `bson:"downvoterIDs"`
	ReplyCount   int                `bson:"replyCount"`
	ParentID     primitive.ObjectID `bson:"parentID"`
	RepostID     primitive.ObjectID `bson:"repostID"`
	RoomID       primitive.ObjectID `bson:"roomID"`
}

PostModel db model

func NewPostModel

func NewPostModel(name string, avatar string, body string, parentID string, repostID string, roomID string) *PostModel

NewPostModel create new post db model

type Posts

type Posts []*Post

Posts list of post

func (Posts) Entity

func (posts Posts) Entity() []service.Post

Entity convert array of post to entity

type Room

type Room struct {
	ID     primitive.ObjectID `bson:"_id"`
	Name   string
	Avatar string
}

Room extract model

func (*Room) Entity

func (m *Room) Entity() room.Room

Entity convert room to entity

type Rooms

type Rooms []*Room

Rooms array of room

func (Rooms) Entity

func (rooms Rooms) Entity() []room.Room

Entity convert array of room to entity

Jump to

Keyboard shortcuts

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