model

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Code generated by goctl. DO NOT EDIT.

Code generated by goctl. DO NOT EDIT.

Code generated by goctl. DO NOT EDIT.

Code generated by goctl. DO NOT EDIT.

Code generated by goctl. DO NOT EDIT.

Code generated by goctl. DO NOT EDIT.

Index

Constants

View Source
const AdminCollectionName = "admin"
View Source
const ApplyCollectionName = "apply"
View Source
const CommunityCollectionName = "community"
View Source
const NewsCollectionName = "news"
View Source
const NoticeCollectionName = "notice"
View Source
const UserRoleCollectionName = "user_role"

Variables

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

Functions

func ToFindOptions

func ToFindOptions(page, size int64, sort map[string]int32) *options.FindOptions

Types

type Admin

type Admin struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	CommunityId string             `bson:"communityId,omitempty" json:"communityId,omitempty"`
	Name        string             `bson:"name,omitempty" json:"name,omitempty"`
	Title       string             `bson:"title,omitempty" json:"title,omitempty"`
	Phone       string             `bson:"phone,omitempty" json:"phone,omitempty"`
	Wechat      string             `bson:"wechat,omitempty" json:"wechat,omitempty"`
	AvatarUrl   string             `bson:"avatarUrl,omitempty" json:"avatarUrl,omitempty"`
	UpdateAt    time.Time          `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt    time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
}

type AdminModel

type AdminModel interface {
	ListAdmin(ctx context.Context, query *pb.ListAdminReq) ([]*Admin, int64, error)
	UpdateAdmin(ctx context.Context, req *pb.UpdateAdminReq) error
	// contains filtered or unexported methods
}

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

func NewAdminModel

func NewAdminModel(url, db, collection string, c cache.CacheConf) AdminModel

NewAdminModel returns a newsmodel for the mongo.

type Apply added in v1.2.2

type Apply struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	ApplicantId string             `bson:"applicantId,omitempty" json:"applicantId,omitempty"`
	CommunityId string             `bson:"communityId,omitempty" json:"communityId,omitempty"`
	UpdateAt    time.Time          `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt    time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
}

type ApplyModel added in v1.2.2

type ApplyModel interface {
	FindAllApplyByCommunityId(ctx context.Context, req *pb.ListApplyReq) ([]*Apply, error)
	// contains filtered or unexported methods
}

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

func NewApplyModel added in v1.2.2

func NewApplyModel(url, db, collection string) ApplyModel

NewApplyModel returns a model for the mongo.

type Community

type Community struct {
	ID       primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Name     string             `bson:"name,omitempty" json:"name,omitempty"`
	ParentId primitive.ObjectID `bson:"parentId,omitempty" json:"parent_id,omitempty"`
	UpdateAt time.Time          `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
}

type CommunityModel

type CommunityModel interface {
	ListCommunity(ctx context.Context, req *pb.ListCommunityReq) ([]*Community, int64, error)
	DeleteCommunity(ctx context.Context, id string) error
	// contains filtered or unexported methods
}

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

func NewCommunityModel

func NewCommunityModel(url, db, collection string, c cache.CacheConf) CommunityModel

NewCommunityModel returns a model for the mongo.

type CustomCommunityModel

type CustomCommunityModel struct {
	// contains filtered or unexported fields
}

func (CustomCommunityModel) Delete

func (m CustomCommunityModel) Delete(ctx context.Context, id string) (int64, error)

func (CustomCommunityModel) DeleteCommunity

func (c CustomCommunityModel) DeleteCommunity(ctx context.Context, id string) error

func (CustomCommunityModel) FindOne

func (m CustomCommunityModel) FindOne(ctx context.Context, id string) (*Community, error)

func (CustomCommunityModel) Insert

func (m CustomCommunityModel) Insert(ctx context.Context, data *Community) error

func (CustomCommunityModel) ListCommunity

func (c CustomCommunityModel) ListCommunity(ctx context.Context, req *pb.ListCommunityReq) ([]*Community, int64, error)

func (CustomCommunityModel) Update

func (m CustomCommunityModel) Update(ctx context.Context, data *Community) (*mongo.UpdateResult, error)

type CustomUserRoleModel

type CustomUserRoleModel struct {
	// contains filtered or unexported fields
}

func (CustomUserRoleModel) Delete

func (m CustomUserRoleModel) Delete(ctx context.Context, id string) (int64, error)

func (CustomUserRoleModel) FindMany added in v1.2.2

func (m CustomUserRoleModel) FindMany(ctx context.Context, role string, communityId string) ([]*UserRole, error)

func (CustomUserRoleModel) FindOne

func (m CustomUserRoleModel) FindOne(ctx context.Context, id string) (*UserRole, error)

func (CustomUserRoleModel) Insert

func (m CustomUserRoleModel) Insert(ctx context.Context, data *UserRole) error

func (CustomUserRoleModel) Update

func (m CustomUserRoleModel) Update(ctx context.Context, data *UserRole) (*mongo.UpdateResult, error)

func (CustomUserRoleModel) Upsert

type News

type News struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	CommunityId string             `bson:"communityId,omitempty" json:"communityId,omitempty"`
	ImageUrl    string             `bson:"imageUrl,omitempty" json:"imageUrl,omitempty"`
	LinkUrl     string             `bson:"linkUrl,omitempty" json:"linkUrl,omitempty"`
	Type        string             `bson:"type,omitempty" json:"type,omitempty"`
	IsPublic    int64              `bson:"isPublic,omitempty" json:"isPublic,omitempty"`
	UpdateAt    time.Time          `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt    time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
}

type NewsModel

type NewsModel interface {
	UpdateNews(ctx context.Context, req *pb.UpdateNewsReq) error
	ListNews(ctx context.Context, req *pb.ListNewsReq) ([]*News, int64, error)
	// contains filtered or unexported methods
}

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

func NewNewsModel

func NewNewsModel(url, db, collection string, c cache.CacheConf) NewsModel

NewNewsModel returns a newsmodel for the mongo.

type Notice

type Notice struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	CommunityId string             `bson:"communityId,omitempty" json:"communityId,omitempty"`
	Text        string             `bson:"text,omitempty" json:"text,omitempty"`
	UpdateAt    time.Time          `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt    time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
}

type NoticeModel

type NoticeModel interface {
	ListNotice(ctx context.Context, req *pb.ListNoticeReq) ([]*Notice, int64, error)
	UpdateNotice(ctx context.Context, req *pb.UpdateNoticeReq) error
	// contains filtered or unexported methods
}

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

func NewNoticeModel

func NewNoticeModel(url, db, collection string, c cache.CacheConf) NoticeModel

NewNoticeModel returns a noticemodel for the mongo.

type Role

type Role struct {
	Type        string `bson:"type,omitempty" json:"type,omitempty"`
	CommunityId string `bson:"communityId,omitempty" json:"communityId,omitempty"`
}

type UserRole

type UserRole struct {
	ID       primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Roles    []Role             `bson:"roles,omitempty" json:"roles,omitempty"`
	UpdateAt time.Time          `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
}

type UserRoleModel

type UserRoleModel interface {
	Upsert(ctx context.Context, data *UserRole) (*mongo.UpdateResult, error)
	FindMany(ctx context.Context, role string, communityId string) ([]*UserRole, error)
	// contains filtered or unexported methods
}

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

func NewUserRoleModel

func NewUserRoleModel(url, db, collection string, c cache.CacheConf) UserRoleModel

NewUserRoleModel returns a model for the mongo.

Jump to

Keyboard shortcuts

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