model

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Code generated by goctl. DO NOT EDIT!

Index

Constants

View Source
const MomentCollectionName = "moment"

Variables

View Source
var (
	ErrNotFound        = mon.ErrNotFound
	ErrInvalidObjectId = errors.New("invalid objectId")
)

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID       primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Comment  string             `bson:"comment,omitempty" json:"comment,omitempty"`
	UserId   primitive.ObjectID `bson:"userId,omitempty" json:"userId,omitempty"`
	CreateAt time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
}

type Moment

type Moment struct {
	ID        primitive.ObjectID   `bson:"_id,omitempty" json:"id,omitempty"`
	CatId     primitive.ObjectID   `bson:"catId,omitempty" json:"catId,omitempty"`
	Comments  []Comment            `bson:"comments,omitempty" json:"comments,omitempty"`
	Photos    []string             `bson:"photos,omitempty" json:"photos,omitempty"`
	Status    int32                `bson:"status,omitempty" json:"status,omitempty"`
	Title     string               `bson:"title,omitempty" json:"title,omitempty"`
	Text      string               `bson:"text,omitempty" json:"text,omitempty"`
	UserId    primitive.ObjectID   `bson:"userId,omitempty" json:"userId,omitempty"`
	UserLikes []primitive.ObjectID `bson:"userLikes,omitempty" json:"userLikes,omitempty"`
	UpdateAt  time.Time            `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt  time.Time            `bson:"createAt,omitempty" json:"createAt,omitempty"`
}

type MomentModel

type MomentModel interface {
	QueryMoment(ctx context.Context, query *pb.QueryMomentReq) ([]*Moment, error)
	// UpdateMomentByIdAndUserId 根据id和userId更新动态(id, userId包含在Req内)
	UpdateMomentByIdAndUserId(ctx context.Context, req *pb.UpdateMomentReq) error
	// DeleteMomentByIdAndUserId 根据id和userId删除动态
	DeleteMomentByIdAndUserId(ctx context.Context, id, userId string) error
	// contains filtered or unexported methods
}

MomentModel is an interface to be customized, add more methods here, and implement the added methods in customMomentModel.

func NewMomentModel

func NewMomentModel(url, db, collection string, c cache.CacheConf) MomentModel

NewMomentModel returns a model for the mongo.

Jump to

Keyboard shortcuts

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