xnote

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: BSD-3-Clause-Clear Imports: 7 Imported by: 0

Documentation

Overview

个人笔记模块

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMenu

func CreateMenu(c *NoteMenu) error

创建笔记菜单标识

c	笔记菜单结构

func CreateMenuId

func CreateMenuId(id, uid, mid uint) error

添加Menu中的menu_id

id	菜单id
uid	用户ID
mid	menu_id

func DeleteMenu

func DeleteMenu(id, uid uint) error

删除笔记菜单

id	笔记菜单ID
uid	用户ID

func DeleteMenuId

func DeleteMenuId(id, uid, mid uint) error

删除Menu中的menu_id

id	菜单id
uid	用户ID
mid	menu_id

func GetContent

func GetContent(id uint) (string, error)

获取笔记内容信息

id	栏目ID

func Regedit

func Regedit(c *Config)

入口配置

func SaveContent

func SaveContent(id uint, cont string) error

存储笔记内容信息

id		栏目ID
cont	栏目内容

Types

type Config

type Config struct {
	DB              *gorm.DB
	NoteContentName string // 笔记内容存储表名
	MenuName        string // 笔记标签/目录存储表明
}

配置项信息

type MenuTree struct {
	Id     uint   `json:"id" form:"id"`         // 菜单ID
	Expert string `json:"expert" form:"expert"` // 多级目录分隔符
	Value  string `json:"value" form:"value"`   // 拼接完成的目录结构
}

获取菜单的目录树结构

func GetMenuTree

func GetMenuTree(ids []uint) ([]MenuTree, error)

获取目录结构信息

ids	待获取的目录列表信息

type NoteContent

type NoteContent struct {
	Id      uint   `gorm:"column:id;primary_key;not null;comment:笔记ID,等同node_menu.id" form:"id" json:"id"` //笔记ID,等同node.id
	Content string `gorm:"column:content;type:longtext;comment:笔记内容" form:"content" json:"content"`        //笔记内容
}

笔记内容存储表

func (*NoteContent) TableName

func (c *NoteContent) TableName() string

返回所属表名信息

type NoteMenu

type NoteMenu struct {
	Id        uint   `gorm:"column:id;primary_key;autoIncrement;not null" form:"id" json:"id"`
	Fid       uint   `gorm:"column:fid;comment:上级ID" form:"fid" json:"fid"`                                         //上级ID
	UserId    uint   `gorm:"column:user_id;comment:所属用户ID" form:"user_id" json:"user_id"`                           //所属用户ID
	Name      string `gorm:"column:name;type:varchar(200);comment:标签/目录名称" form:"name" json:"name"`                 //标签/目录名称
	Type      uint8  `gorm:"column:type;comment:所属分类 1-菜单 2-内容" form:"type" json:"type"`                            //所属分类 1-菜单 2-内容
	MenuId    string `gorm:"column:menu_id;type:varchar(200);comment:所属目录/标签,关联menu" form:"menu_id" json:"menu_id"` //所属目录/标签,关联menu
	IsDeleted uint8  `gorm:"column:is_deleted;type:tinyint unsigned;comment:是否删除" form:"-" json:"-"`                //是否删除
	CreatedAt string `gorm:"column:created_at;type:datetime;comment:添加时间" form:"created_at" json:"created_at"`      //添加时间
	UpdatedAt string `gorm:"column:updated_at;type:datetime;comment:修改时间" form:"updated_at" json:"updated_at"`      //修改时间
}

笔记菜单/标签名称表

func GetMenu

func GetMenu(uid, fid uint) ([]NoteMenu, error)

获取笔记菜单标识

uid	用户ID
fid	上级菜单ID

func GetMenuInfo added in v0.2.7

func GetMenuInfo(id uint) (*NoteMenu, error)

获取菜单详情

id	菜单ID

func (*NoteMenu) TableName

func (c *NoteMenu) TableName() string

返回所属表名信息

Jump to

Keyboard shortcuts

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