db

package
v0.0.0-...-102e12a Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ThinkNote

type ThinkNote model.ThinkingNote

func GetThinkingNote

func GetThinkingNote() *ThinkNote

func (*ThinkNote) Insert

func (tn *ThinkNote) Insert(data *model.ThinkingNote) error

func (*ThinkNote) QueryFirst

func (tn *ThinkNote) QueryFirst(condition string, params ...interface{}) (note *model.ThinkingNote, err error)

QueryFirst 仅选择未删除的笔记

func (*ThinkNote) QueryPageByWriter

func (tn *ThinkNote) QueryPageByWriter(
	pageSize int,
	pageNum int,
	userID string,
) (notes []*model.ThinkingNote, count int, err error)

QueryPageByWriter 不查询已删除的记录,按照更新时间降序

func (*ThinkNote) QueryPageInPublic

func (tn *ThinkNote) QueryPageInPublic(
	pageSize int,
	pageNum int,
	userID string,
) (notes []*model.ThinkingNote, count int, err error)

QueryPageInPublic 获取公开笔记列表,要求编辑者权限等级不高于指定用户(通过userID指定),分页,不查询已删除的记录,按照更新时间降序 * Core: sub-query

select *
from thinking_note tn
where tn.write_by in (
	select "user_id"
	from users u
	where "permission" <= (
		select "permission"
		from users u2
		where user_id = 'user id'
	)
);

func (*ThinkNote) UpdateColumnsByNoteID

func (tn *ThinkNote) UpdateColumnsByNoteID(data *model.ThinkingNote, columns ...string) error

UpdateColumnsByNoteID 仅可操作未删除的笔记

Jump to

Keyboard shortcuts

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