dao

package
v0.0.0-...-63a9e4b Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const UserRelationTableName = "t_user_relation"

Variables

This section is empty.

Functions

func AddContactFromUser

func AddContactFromUser(uidOwner int64, uidFriend int64, groupName string) (res *v10.Contact, err error)

func AddContactFromUserInternal

func AddContactFromUserInternal(uidOwner int64, uidFriend int64, groupName string, isGroup, relationship int32, remarkName, tags, remarks string) (res *v10.Contact, err error)

func AddFriend

func AddFriend(relation *v10.Relation) (ret *v10.FriendUserInfo, err error)

* ** 添加好友 ** return userInfo *

func AddFriend2

func AddFriend2(relation *v10.Relation) (ret *v10.FriendUserInfo, err error)

func DeleteFriend

func DeleteFriend(relation *v10.Relation) bool

* 删除好友

func GetContact

func GetContact(req *v10.GetContactReq) (res *v10.GetContactReply, err error)

func GetFriendList

func GetFriendList(autoId int64, uid string) ([]*v10.FriendUserInfo, error)

* 获取好友列表

func GetUserDdevices

func GetUserDdevices(uid int64) (ret []*v10.DeviceUserRelation, err error)

func GetUserInfoByAutoId

func GetUserInfoByAutoId(autoId int64) (*v10.UserInfo, error)

通过自增长的id

func GetUserInfoByPhone

func GetUserInfoByPhone(phone string) (*v10.UserInfo, error)

验证码验证通过后直接调用该方法登录

func GetUserInfoByUid

func GetUserInfoByUid(uid string) (*v10.UserInfo, error)

* ** 获取某个用户详情 *

func IsExistDevice

func IsExistDevice(uid int64, deviceId string) (yes bool, dur *v10.DeviceUserRelation)

func ListContacts

func ListContacts(uidOwner int64) (res *v10.ContactGroups, err error)

func RemoveContact

func RemoveContact(req *v10.RemoveContactReq) (res *v10.RemoveContactReply, err error)

func SaveOrUpdateDevice

func SaveOrUpdateDevice(uid int64, device *v10.Device) (dur *v10.DeviceUserRelation, err error)

func TxRollback

func TxRollback(tx *gorm.DB, err error)

func UpdateContact

func UpdateContact(req *v10.UpdateContactReq) (res *v10.UpdateContactReply, err error)

func UpdateFriend

func UpdateFriend(relation *v10.Relation) (ret *v10.Relation, err error)

* ** 修改朋友信息(增加备注,拉黑名单等) *

func UpdateFriend2

func UpdateFriend2(relation *v10.Relation) (*v10.Relation, error)

func UpdateUserInfo

func UpdateUserInfo(userInfo *v10.UserInfo) (ok bool, err error, obj *models.User)

* ** 修改用户信息 *

func UserGetFriends

func UserGetFriends()

* ** 获取朋友列表 *

func UserLoginByPhoneCode

func UserLoginByPhoneCode(phone string) *v10.UserInfo

* ** 验证码验证通过后采用这个登录 *

func UserLoginUsePass

func UserLoginUsePass(userInfo *v10.UserInfo) (ret *v10.UserInfo, err error)

* ** 用户登录(密码方式/Mobile/Phone) *

func UserRegister

func UserRegister(userInfo *v10.UserInfo) (*v10.UserInfo, error)

* ** 新用户注册 *

Types

type AppDao

type AppDao struct{}

func NewAppDao

func NewAppDao() *AppDao

func (*AppDao) AddOrUpdate

func (s *AppDao) AddOrUpdate(in *models.App) (ret *models.App, err error)

func (*AppDao) Get

func (s *AppDao) Get(tmpl *models.App) (ret *models.App, err error)

func (*AppDao) GetById

func (s *AppDao) GetById(id uint64) (ret *models.App, err error)

func (*AppDao) List

func (s *AppDao) List(limit, start int64, orderBy string, query interface{}, args ...interface{}) (ret []*models.App, err error)

func (*AppDao) ListFast

func (s *AppDao) ListFast(query interface{}, args ...interface{}) (ret []*models.App, err error)

func (*AppDao) Remove

func (s *AppDao) Remove(tmpl *models.App) (rows int64, err error)

func (*AppDao) RemoveById

func (s *AppDao) RemoveById(id uint64) (rows int64, err error)

Soft Delete

func (*AppDao) Update

func (s *AppDao) Update(in *models.App) (rows int64, err error)

func (*AppDao) Where

func (s *AppDao) Where(query interface{}, args ...interface{}) *gorm.DB

type FilterDao

type FilterDao struct{}

func NewFilterDao

func NewFilterDao() *FilterDao

func (*FilterDao) AddOrUpdate

func (s *FilterDao) AddOrUpdate(in *models.Filter) (ret *models.Filter, err error)

not recommended

func (*FilterDao) Get

func (s *FilterDao) Get(tmpl *models.Filter) (ret *models.Filter, err error)

func (*FilterDao) GetById

func (s *FilterDao) GetById(id uint64) (ret *models.Filter, err error)

func (*FilterDao) List

func (s *FilterDao) List(limit, start int64, orderBy string, query interface{}, args ...interface{}) (ret []*models.Filter, err error)

func (*FilterDao) ListFast

func (s *FilterDao) ListFast(query interface{}, args ...interface{}) (ret []*models.Filter, err error)

func (*FilterDao) Remove

func (s *FilterDao) Remove(tmpl *models.Filter) (rows int64, err error)

func (*FilterDao) RemoveById

func (s *FilterDao) RemoveById(id uint64) (rows int64, err error)

Soft Delete

func (*FilterDao) Update

func (s *FilterDao) Update(in *models.Filter) (rows int64, err error)

func (*FilterDao) Where

func (s *FilterDao) Where(query interface{}, args ...interface{}) *gorm.DB

type HookDao

type HookDao struct{}

func NewHookDao

func NewHookDao() *HookDao

func (*HookDao) AddOrUpdate1

func (s *HookDao) AddOrUpdate1(in *models.Hook) (ret *models.Hook, err error)

not recommended

func (*HookDao) Get

func (s *HookDao) Get(tmpl *models.Hook) (ret *models.Hook, err error)

func (*HookDao) GetById

func (s *HookDao) GetById(id uint64) (ret *models.Hook, err error)

func (*HookDao) List

func (s *HookDao) List(limit, start int64, orderBy string, query interface{}, args ...interface{}) (ret []*models.Hook, err error)

func (*HookDao) Remove

func (s *HookDao) Remove(tmpl *models.Hook) (rows int64, err error)

func (*HookDao) RemoveById

func (s *HookDao) RemoveById(id uint64) (rows int64, err error)

Soft Delete

func (*HookDao) Update

func (s *HookDao) Update(in *models.Hook) (rows int64, err error)

func (*HookDao) Where

func (s *HookDao) Where(query interface{}, args ...interface{}) *gorm.DB

type MemberDao

type MemberDao struct{}

func NewMemberDao

func NewMemberDao() *MemberDao

func (*MemberDao) AddOrUpdate1

func (s *MemberDao) AddOrUpdate1(in *models.Member) (ret *models.Member, err error)

not recommended

func (*MemberDao) Get

func (s *MemberDao) Get(tmpl *models.Member) (ret *models.Member, err error)

func (*MemberDao) GetById

func (s *MemberDao) GetById(id uint64) (ret *models.Member, err error)

func (*MemberDao) LazyLoad

func (s *MemberDao) LazyLoad(model *models.Member) (ret *v10.Member, err error)

func (*MemberDao) List

func (s *MemberDao) List(limit, start int64, orderBy string, query interface{}, args ...interface{}) (ret []*models.Member, err error)

func (*MemberDao) Remove

func (s *MemberDao) Remove(tmpl *models.Member) (rows int64, err error)

func (*MemberDao) RemoveById

func (s *MemberDao) RemoveById(id uint64) (rows int64, err error)

Soft Delete

func (*MemberDao) Update

func (s *MemberDao) Update(in *models.Member) (rows int64, err error)

func (*MemberDao) Where

func (s *MemberDao) Where(query interface{}, args ...interface{}) *gorm.DB

type MsgDao

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

func NewMsgDao

func NewMsgDao() *MsgDao

func (*MsgDao) AddOrUpdate1

func (s *MsgDao) AddOrUpdate1(in *models.Msg) (ret *models.Msg, err error)

don't use this func because it's not completed on the internal affairs, such as updateing MsgLastPt, notifying others, pre/post filter, ...

func (*MsgDao) AddTo

func (s *MsgDao) AddTo(in *models.Msg, deviceId, parentId, orgId uint64) (toUsers []uint64, err error)

for api.SendMsg: AddTo() append/insert an `in` msg into `t_msg` table.

if in.TopicId == 0, AddTo() will create a Room/DirectMessage as an new Topic. Room is a special Topic, just like conversation group for multiple users/members. DirectMessage is a peer-to-peer Topic, it's special for two peers conversation.

func (*MsgDao) Get

func (s *MsgDao) Get(tmpl *models.Msg) (ret *models.Msg, err error)

func (*MsgDao) GetById

func (s *MsgDao) GetById(id uint64) (ret *models.Msg, err error)

func (*MsgDao) List

func (s *MsgDao) List(limit int, start int, query interface{}, args ...interface{}) (ret []*models.Msg, err error)

func (*MsgDao) ListBy

func (s *MsgDao) ListBy(autoAck bool, userId, topicId uint64, limit int, orderBy, whereCondition string, whereArgs ...interface{}) (ret []*models.Msg, err error)

func (*MsgDao) ListFromParent

func (s *MsgDao) ListFromParent(parent *models.Msg, topicId uint64) (ret []*models.Msg, err error)

ListFromParent 列出给定上级msg的全部下级msg, 包含该上级

func (*MsgDao) ListFromParentId

func (s *MsgDao) ListFromParentId(parentId uint64, topicId uint64) (ret []*models.Msg, err error)

ListFromParentId 列出给定上级msg的全部下级msg, 包含该上级 parentId=0 时列出给定 topic 中的全部msgs

func (*MsgDao) MsgAcked

func (s *MsgDao) MsgAcked(memberId, topicId uint64, count, distance int, msgIds ...uint64) (err error)

func (*MsgDao) Remove

func (s *MsgDao) Remove(tmpl *models.Msg) (err error)

func (*MsgDao) RemoveById

func (s *MsgDao) RemoveById(id uint64) (err error)

Soft Delete

func (*MsgDao) Update

func (s *MsgDao) Update(in *models.Msg) (err error)

func (*MsgDao) Where

func (s *MsgDao) Where(query interface{}, args ...interface{}) *gorm.DB

type OrgDao

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

func NewOrgDao

func NewOrgDao() *OrgDao

func (*OrgDao) AddOrUpdate

func (s *OrgDao) AddOrUpdate(in *models.Organization, parentId uint64) (ret *models.Organization, err error)

func (*OrgDao) AddTo1

func (s *OrgDao) AddTo1(in *models.Organization, parentId uint64) (err error)

func (*OrgDao) Get

func (s *OrgDao) Get(tmpl *models.Organization) (ret *models.Organization, err error)

func (*OrgDao) GetById

func (s *OrgDao) GetById(id uint64) (ret *models.Organization, err error)

func (*OrgDao) LazyLoad

func (s *OrgDao) LazyLoad(model *models.Organization) (ret *v10.Organization, err error)

load the lazy objects

func (*OrgDao) List

func (s *OrgDao) List(limit, start int64, orderBy string, query interface{}, args ...interface{}) (ret []*models.Organization, err error)

func (*OrgDao) ListFromParent

func (s *OrgDao) ListFromParent(parent *models.Organization) (ret []*models.Organization, err error)

ListFromParent 列出给定上级组织的全部下级组织

func (*OrgDao) ListFromParentId

func (s *OrgDao) ListFromParentId(parentId uint64) (ret []*models.Organization, err error)

ListFromParentId 列出给定上级组织的全部下级组织

func (*OrgDao) Remove

func (s *OrgDao) Remove(tmpl *models.Organization) (rows int64, err error)

func (*OrgDao) RemoveById

func (s *OrgDao) RemoveById(id uint64) (rows int64, err error)

Soft Delete

func (*OrgDao) Update

func (s *OrgDao) Update(in *models.Organization) (err error)

func (*OrgDao) UpdateAttrs

func (s *OrgDao) UpdateAttrs(attrs ...interface{}) (err error)

func (*OrgDao) Where

func (s *OrgDao) Where(query interface{}, args ...interface{}) *gorm.DB

type TopicAppDao

type TopicAppDao struct{}

func NewTopicAppDao

func NewTopicAppDao() *TopicAppDao

func (*TopicAppDao) AddOrUpdate

func (s *TopicAppDao) AddOrUpdate(in *models.TopicApp) (ret *models.TopicApp, err error)

func (*TopicAppDao) Get

func (s *TopicAppDao) Get(tmpl *models.TopicApp) (ret *models.TopicApp, err error)

func (*TopicAppDao) GetById

func (s *TopicAppDao) GetById(id uint64) (ret *models.TopicApp, err error)

func (*TopicAppDao) GetByIdEager

func (s *TopicAppDao) GetByIdEager(id uint64) (ret *models.TopicApp, err error)

func (*TopicAppDao) List

func (s *TopicAppDao) List(limit, start int64, orderBy string, query interface{}, args ...interface{}) (ret []*models.TopicApp, err error)

func (*TopicAppDao) ListEager

func (s *TopicAppDao) ListEager(query interface{}, args ...interface{}) (ret []*models.TopicApp, err error)

func (*TopicAppDao) Remove

func (s *TopicAppDao) Remove(tmpl *models.TopicApp) (rows int64, err error)

func (*TopicAppDao) RemoveById

func (s *TopicAppDao) RemoveById(id uint64) (rows int64, err error)

Soft Delete

func (*TopicAppDao) Update

func (s *TopicAppDao) Update(in *models.TopicApp) (rows int64, err error)

func (*TopicAppDao) Where

func (s *TopicAppDao) Where(query interface{}, args ...interface{}) *gorm.DB

type TopicDao

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

func NewTopicDao

func NewTopicDao() *TopicDao

func (*TopicDao) Add

func (s *TopicDao) Add(in *models.Topic, parentId uint64) (err error)

insert or update.

func (*TopicDao) CreateRoomOrDirectMessage

func (s *TopicDao) CreateRoomOrDirectMessage(orgId, moderator uint64, others ...uint64) (topicId uint64, out *models.Topic, err error)

Room/DirectMessage 没有专设bot,所以不要创建一个botUser。 但 FxBot 仍然自动属于一个 Room/DirectMessage,因此系统级的消息分发依然有效,而 Room 管理员无法通过自动化工具进行消息分发。

func (*TopicDao) Get

func (s *TopicDao) Get(tmpl *models.Topic) (ret *models.Topic, err error)

func (*TopicDao) GetById

func (s *TopicDao) GetById(id uint64) (ret *models.Topic, err error)

func (*TopicDao) GetMemberPkIds

func (s *TopicDao) GetMemberPkIds(topicId uint64) (ret []uint64, err error)

func (*TopicDao) GetMemberUserIds

func (s *TopicDao) GetMemberUserIds(topicId uint64) (ret []uint64, err error)

func (*TopicDao) GetMemberUserIdsNotIn

func (s *TopicDao) GetMemberUserIdsNotIn(topicId uint64, notInUsers []uint64) (ret []uint64, err error)

func (*TopicDao) GetMembers

func (s *TopicDao) GetMembers(topicId uint64) (ret []models.Member, err error)

func (*TopicDao) LazyLoad

func (s *TopicDao) LazyLoad(model *models.Topic) (ret *v10.Topic, err error)

load the lazy objects

func (*TopicDao) List

func (s *TopicDao) List(limit, start int64, orderBy string, query interface{}, args ...interface{}) (ret []*models.Topic, err error)

func (*TopicDao) ListFromParent

func (s *TopicDao) ListFromParent(parent *models.Topic) (ret []*models.Topic, err error)

ListFromParent 列出给定上级话题的全部下级话题

func (*TopicDao) ListFromParentId

func (s *TopicDao) ListFromParentId(parentId uint64) (ret []*models.Topic, err error)

ListFromParentId 列出给定上级话题的全部下级话题

func (*TopicDao) Remove

func (s *TopicDao) Remove(tmpl *models.Topic) (rows int64, err error)

func (*TopicDao) RemoveById

func (s *TopicDao) RemoveById(id uint64) (err error)

Soft Delete

func (*TopicDao) Update

func (s *TopicDao) Update(in *models.Topic) (err error)

func (*TopicDao) Where

func (s *TopicDao) Where(query interface{}, args ...interface{}) *gorm.DB

type UserDao

type UserDao struct{}

func (*UserDao) Add

func (s *UserDao) Add(in *models.User) (id uint64, err error)

func (*UserDao) Get

func (s *UserDao) Get(tmpl *models.User) (ret *models.User, err error)

func (*UserDao) GetById

func (s *UserDao) GetById(id uint64) (ret *models.User, err error)

func (*UserDao) List

func (s *UserDao) List(tmpl *models.User) (ret []*models.User, err error)

func (*UserDao) Remove

func (s *UserDao) Remove(tmpl *models.User) (rows int64, err error)

func (*UserDao) RemoveById

func (s *UserDao) RemoveById(id uint64) (rows int64, err error)

func (*UserDao) Update

func (s *UserDao) Update(in *models.User) (ret *models.User, rows int64, err error)

Jump to

Keyboard shortcuts

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