Documentation
¶
Index ¶
- type Data
- type GetOption
- type GetOptionFunc
- type NoteAssetData
- func (d *NoteAssetData) BatchInsert(ctx context.Context, assets []*notedao.AssetPO) error
- func (d *NoteAssetData) BatchUpdateAssetMeta(ctx context.Context, noteId int64, metas map[string][]byte) error
- func (d *NoteAssetData) DeleteByNoteId(ctx context.Context, noteId int64) error
- func (d *NoteAssetData) DeleteByNoteIdExcept(ctx context.Context, noteId int64, assetKeys []string) error
- func (d *NoteAssetData) FindByNoteIds(ctx context.Context, noteIds []int64) ([]*notedao.AssetPO, error)
- func (d *NoteAssetData) FindImageNoteAssets(ctx context.Context, noteId int64) ([]*notedao.AssetPO, error)
- func (d *NoteAssetData) FindOne(ctx context.Context, id int64) (*notedao.AssetPO, error)
- func (d *NoteAssetData) FindVideoNoteAssets(ctx context.Context, noteId int64) ([]*notedao.AssetPO, error)
- func (d *NoteAssetData) Insert(ctx context.Context, asset *notedao.AssetPO) error
- type NoteCondition
- func WithNoteOwnerEqual(uid int64) NoteCondition
- func WithNotePrivacyEqual(privacy model.Privacy) NoteCondition
- func WithNoteStateEqual(state model.NoteState) NoteCondition
- func WithNoteStateIn(states ...model.NoteState) NoteCondition
- func WithNoteStateNotIn(states ...model.NoteState) NoteCondition
- func WithNoteTypeEqual(noteType model.NoteType) NoteCondition
- type NoteData
- func (d *NoteData) BatchGet(ctx context.Context, ids []int64, opts ...GetOptionFunc) (map[int64]*notedao.NotePO, error)
- func (d *NoteData) ConvertNotes(notes []*notedao.NotePO) []*model.Note
- func (d *NoteData) Count(ctx context.Context, conds ...NoteCondition) (int64, error)
- func (d *NoteData) Delete(ctx context.Context, noteId int64) error
- func (d *NoteData) DeleteNote(ctx context.Context, po *notedao.NotePO) error
- func (d *NoteData) FindOne(ctx context.Context, id int64, opts ...GetOptionFunc) (*notedao.NotePO, error)
- func (d *NoteData) FindOneForUpdate(ctx context.Context, id int64) (*notedao.NotePO, error)
- func (d *NoteData) GetCountWithStateByOwner(ctx context.Context, uid int64, states ...model.NoteState) (int64, error)
- func (d *NoteData) GetNoteType(ctx context.Context, id int64) (model.NoteType, error)
- func (d *NoteData) GetPostedCountByOwner(ctx context.Context, uid int64, opts ...GetOptionFunc) (int64, error)
- func (d *NoteData) GetPublicAll(ctx context.Context) ([]*notedao.NotePO, error)
- func (d *NoteData) GetPublicByCursor(ctx context.Context, id int64, count int) ([]*notedao.NotePO, error)
- func (d *NoteData) GetPublicCount(ctx context.Context) (int64, error)
- func (d *NoteData) GetPublicLastId(ctx context.Context) (int64, error)
- func (d *NoteData) GetPublicPostedCountByOwner(ctx context.Context, uid int64, opts ...GetOptionFunc) (int64, error)
- func (d *NoteData) GetRecentPublicPosted(ctx context.Context, uid int64, count int32) ([]*notedao.NotePO, error)
- func (d *NoteData) Insert(ctx context.Context, note *notedao.NotePO) (int64, error)
- func (d *NoteData) List(ctx context.Context, conds ...NoteCondition) ([]*notedao.NotePO, error)
- func (d *NoteData) ListByCursor(ctx context.Context, cursor int64, limit int32, conds ...NoteCondition) ([]*notedao.NotePO, error)
- func (d *NoteData) ListByPage(ctx context.Context, page, count int32, conds ...NoteCondition) ([]*notedao.NotePO, error)
- func (d *NoteData) Update(ctx context.Context, note *notedao.NotePO) error
- func (d *NoteData) UpdateState(ctx context.Context, noteId int64, state model.NoteState) error
- func (d *NoteData) UpgradeState(ctx context.Context, noteId int64, state model.NoteState) error
- type NoteExtData
- func (d *NoteExtData) BatchGetById(ctx context.Context, noteIds []int64) ([]*notedao.ExtPO, error)
- func (d *NoteExtData) Delete(ctx context.Context, noteId int64) error
- func (d *NoteExtData) GetById(ctx context.Context, noteId int64) (*notedao.ExtPO, error)
- func (d *NoteExtData) Upsert(ctx context.Context, ext *notedao.ExtPO) error
- type ProcedureRecordData
- func (d *ProcedureRecordData) Delete(ctx context.Context, noteId int64, protype model.ProcedureType) error
- func (d *ProcedureRecordData) Get(ctx context.Context, noteId int64, protype model.ProcedureType) (*notedao.ProcedureRecordPO, error)
- func (d *ProcedureRecordData) GetEarliestNextCheckTimeRecord(ctx context.Context, status model.ProcedureStatus) (*notedao.ProcedureRecordPO, error)
- func (d *ProcedureRecordData) GetForUpdate(ctx context.Context, noteId int64, protype model.ProcedureType) (*notedao.ProcedureRecordPO, error)
- func (d *ProcedureRecordData) ListNextCheckTimeByRange(ctx context.Context, status model.ProcedureStatus, start int64, end int64, ...) ([]*notedao.ProcedureRecordPO, error)
- func (d *ProcedureRecordData) UpdateRetry(ctx context.Context, noteId int64, protype model.ProcedureType, ...) error
- func (d *ProcedureRecordData) UpdateRetryMarkFailure(ctx context.Context, noteId int64, protype model.ProcedureType, ...) error
- func (d *ProcedureRecordData) UpdateStatus(ctx context.Context, noteId int64, protype model.ProcedureType, ...) error
- func (d *ProcedureRecordData) UpdateTaskId(ctx context.Context, noteId int64, protype model.ProcedureType, taskId string) error
- func (d *ProcedureRecordData) UpdateTaskIdRetryNextCheckTime(ctx context.Context, record *notedao.ProcedureRecordPO) error
- func (d *ProcedureRecordData) Upsert(ctx context.Context, record *notedao.ProcedureRecordPO) error
- type TagData
- func (d *TagData) BatchGetById(ctx context.Context, ids []int64, opts ...GetOptionFunc) ([]*tagdao.Tag, error)
- func (d *TagData) Create(ctx context.Context, tag *tagdao.Tag) (int64, error)
- func (d *TagData) FindById(ctx context.Context, id int64, opts ...GetOptionFunc) (*tagdao.Tag, error)
- func (d *TagData) FindByName(ctx context.Context, name string, opts ...GetOptionFunc) (*tagdao.Tag, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct {
Note *NoteData
NoteAsset *NoteAssetData
NoteExt *NoteExtData
ProcedureRecord *ProcedureRecordData
Tag *TagData
NoteEventBus *event.NoteEventBus
// contains filtered or unexported fields
}
Data 数据层入口 协调数据库和缓存操作,对上层(biz)屏蔽底层数据存取细节
type NoteAssetData ¶
type NoteAssetData struct {
// contains filtered or unexported fields
}
NoteAssetData 笔记资源数据层
func NewNoteAssetData ¶
func NewNoteAssetData(repo *notedao.NoteAssetRepo) *NoteAssetData
func (*NoteAssetData) BatchInsert ¶
批量插入资源
func (*NoteAssetData) BatchUpdateAssetMeta ¶
func (d *NoteAssetData) BatchUpdateAssetMeta(ctx context.Context, noteId int64, metas map[string][]byte) error
批量更新资源元数据
func (*NoteAssetData) DeleteByNoteId ¶
func (d *NoteAssetData) DeleteByNoteId(ctx context.Context, noteId int64) error
删除笔记的所有资源
func (*NoteAssetData) DeleteByNoteIdExcept ¶
func (d *NoteAssetData) DeleteByNoteIdExcept(ctx context.Context, noteId int64, assetKeys []string) error
删除笔记的资源(排除指定的key)
func (*NoteAssetData) FindByNoteIds ¶
func (d *NoteAssetData) FindByNoteIds(ctx context.Context, noteIds []int64) ([]*notedao.AssetPO, error)
根据笔记ID批量获取资源
func (*NoteAssetData) FindImageNoteAssets ¶
func (d *NoteAssetData) FindImageNoteAssets(ctx context.Context, noteId int64) ([]*notedao.AssetPO, error)
获取笔记的图片资源
func (*NoteAssetData) FindVideoNoteAssets ¶
type NoteCondition ¶
type NoteCondition = notedao.NoteRepoCondition
NoteCondition 笔记查询条件(重新导出给 Biz 层使用)
func WithNoteOwnerEqual ¶
func WithNoteOwnerEqual(uid int64) NoteCondition
WithNoteOwnerEqual 指定笔记所有者
func WithNotePrivacyEqual ¶
func WithNotePrivacyEqual(privacy model.Privacy) NoteCondition
WithNotePrivacyEqual 指定笔记隐私类型
func WithNoteStateEqual ¶
func WithNoteStateEqual(state model.NoteState) NoteCondition
WithNoteStateEqual 指定笔记状态
func WithNoteStateIn ¶
func WithNoteStateIn(states ...model.NoteState) NoteCondition
func WithNoteStateNotIn ¶
func WithNoteStateNotIn(states ...model.NoteState) NoteCondition
WithNoteStateNotIn 排除指定状态
func WithNoteTypeEqual ¶
func WithNoteTypeEqual(noteType model.NoteType) NoteCondition
WithNoteTypeEqual 指定笔记类型
type NoteData ¶
type NoteData struct {
// contains filtered or unexported fields
}
NoteData 笔记数据层 - 协调数据库和缓存操作
func (*NoteData) BatchGet ¶
func (d *NoteData) BatchGet(ctx context.Context, ids []int64, opts ...GetOptionFunc) (map[int64]*notedao.NotePO, error)
BatchGet 批量获取笔记,支持缓存选项
func (*NoteData) ConvertNotes ¶
ConvertNotes 将dao层的NotePO转换为model层的Note
func (*NoteData) DeleteNote ¶
func (*NoteData) FindOne ¶
func (d *NoteData) FindOne(ctx context.Context, id int64, opts ...GetOptionFunc) (*notedao.NotePO, error)
FindOne 获取单个笔记,支持缓存选项
func (*NoteData) FindOneForUpdate ¶
FindOneForUpdate 获取单个笔记用于更新(带行锁,不使用缓存)
func (*NoteData) GetCountWithStateByOwner ¶
func (*NoteData) GetNoteType ¶
GetNoteType 获取笔记类型
func (*NoteData) GetPostedCountByOwner ¶
func (d *NoteData) GetPostedCountByOwner(ctx context.Context, uid int64, opts ...GetOptionFunc) (int64, error)
GetPostedCountByOwner 获取用户发布的笔记数量,支持缓存选项
func (*NoteData) GetPublicAll ¶
GetPublicAll 获取所有公开笔记
func (*NoteData) GetPublicByCursor ¶
func (d *NoteData) GetPublicByCursor(ctx context.Context, id int64, count int) ([]*notedao.NotePO, error)
GetPublicByCursor 按游标获取公开笔记
func (*NoteData) GetPublicCount ¶
GetPublicCount 获取公开笔记数量
func (*NoteData) GetPublicLastId ¶
GetPublicLastId 获取最后一个公开笔记ID
func (*NoteData) GetPublicPostedCountByOwner ¶
func (d *NoteData) GetPublicPostedCountByOwner(ctx context.Context, uid int64, opts ...GetOptionFunc) (int64, error)
GetPublicPostedCountByOwner 获取用户公开发布的笔记数量,支持缓存选项
func (*NoteData) GetRecentPublicPosted ¶
func (d *NoteData) GetRecentPublicPosted(ctx context.Context, uid int64, count int32) ([]*notedao.NotePO, error)
GetRecentPublicPosted 获取用户最近发布的公开笔记
func (*NoteData) ListByCursor ¶
func (d *NoteData) ListByCursor(ctx context.Context, cursor int64, limit int32, conds ...NoteCondition) ([]*notedao.NotePO, error)
ListByCursor 游标分页查询笔记(支持 conditions)
func (*NoteData) ListByPage ¶
func (d *NoteData) ListByPage(ctx context.Context, page, count int32, conds ...NoteCondition) ([]*notedao.NotePO, error)
ListByPage 页码分页查询笔记(支持 conditions)
func (*NoteData) UpdateState ¶
UpdateState 更新笔记状态,同时删除缓存
type NoteExtData ¶
type NoteExtData struct {
// contains filtered or unexported fields
}
NoteExtData 笔记扩展信息数据层
func NewNoteExtData ¶
func NewNoteExtData(repo *notedao.NoteExtRepo) *NoteExtData
func (*NoteExtData) BatchGetById ¶
BatchGetById 批量获取扩展信息
func (*NoteExtData) Delete ¶
func (d *NoteExtData) Delete(ctx context.Context, noteId int64) error
Delete 删除扩展信息
type ProcedureRecordData ¶
type ProcedureRecordData struct {
// contains filtered or unexported fields
}
ProcedureRecordData 流程记录数据层
func NewProcedureRecordData ¶
func NewProcedureRecordData(repo *notedao.ProcedureRecordRepo) *ProcedureRecordData
func (*ProcedureRecordData) Delete ¶
func (d *ProcedureRecordData) Delete( ctx context.Context, noteId int64, protype model.ProcedureType, ) error
Delete 删除流程记录
func (*ProcedureRecordData) Get ¶
func (d *ProcedureRecordData) Get( ctx context.Context, noteId int64, protype model.ProcedureType, ) (*notedao.ProcedureRecordPO, error)
Get 获取流程记录
func (*ProcedureRecordData) GetEarliestNextCheckTimeRecord ¶
func (d *ProcedureRecordData) GetEarliestNextCheckTimeRecord( ctx context.Context, status model.ProcedureStatus, ) (*notedao.ProcedureRecordPO, error)
GetEarliestNextCheckTimeRecord 获取最早需要检查的流程记录
func (*ProcedureRecordData) GetForUpdate ¶
func (d *ProcedureRecordData) GetForUpdate( ctx context.Context, noteId int64, protype model.ProcedureType, ) (*notedao.ProcedureRecordPO, error)
func (*ProcedureRecordData) ListNextCheckTimeByRange ¶
func (d *ProcedureRecordData) ListNextCheckTimeByRange( ctx context.Context, status model.ProcedureStatus, start int64, end int64, offsetId int64, limit int, shardIndex int, shardTotal int, ) ([]*notedao.ProcedureRecordPO, error)
ListNextCheckTimeByRange 获取指定时间范围内需要检查的流程记录
func (*ProcedureRecordData) UpdateRetry ¶
func (d *ProcedureRecordData) UpdateRetry( ctx context.Context, noteId int64, protype model.ProcedureType, nextCheckTime int64, ) error
UpdateRetry 更新流程记录重试次数
func (*ProcedureRecordData) UpdateRetryMarkFailure ¶
func (d *ProcedureRecordData) UpdateRetryMarkFailure( ctx context.Context, noteId int64, protype model.ProcedureType, nextCheckTime int64, ) error
UpdateRetryMarkFailure 更新流程记录重试次数并标记失败
func (*ProcedureRecordData) UpdateStatus ¶
func (d *ProcedureRecordData) UpdateStatus( ctx context.Context, noteId int64, protype model.ProcedureType, status model.ProcedureStatus, ) error
UpdateStatus 更新流程记录状态
func (*ProcedureRecordData) UpdateTaskId ¶
func (d *ProcedureRecordData) UpdateTaskId( ctx context.Context, noteId int64, protype model.ProcedureType, taskId string, ) error
UpdateTaskId 更新流程记录的任务ID
func (*ProcedureRecordData) UpdateTaskIdRetryNextCheckTime ¶
func (d *ProcedureRecordData) UpdateTaskIdRetryNextCheckTime( ctx context.Context, record *notedao.ProcedureRecordPO, ) error
UpdateRecord 更新流程记录
func (*ProcedureRecordData) Upsert ¶
func (d *ProcedureRecordData) Upsert(ctx context.Context, record *notedao.ProcedureRecordPO) error
Upsert 插入流程记录
type TagData ¶
type TagData struct {
// contains filtered or unexported fields
}
TagData 标签数据层 - 协调数据库和缓存操作
func (*TagData) BatchGetById ¶
func (d *TagData) BatchGetById(ctx context.Context, ids []int64, opts ...GetOptionFunc) ([]*tagdao.Tag, error)
BatchGetById 批量根据ID获取标签,支持缓存选项
func (*TagData) FindById ¶
func (d *TagData) FindById(ctx context.Context, id int64, opts ...GetOptionFunc) (*tagdao.Tag, error)
FindById 根据ID获取标签,支持缓存选项
func (*TagData) FindByName ¶
func (d *TagData) FindByName(ctx context.Context, name string, opts ...GetOptionFunc) (*tagdao.Tag, error)
FindByName 根据名称获取标签,支持缓存选项