note

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

README

笔记接口

添加

POST /note

Param

Return

  • code (int) 请求返回码,一般0表示正常,非0表示异常
  • msg (string) 信息,一般是出错时的描述信息
  • data (object)
    • id (int) 新纪录ID
Param
{}
Return
{
    "code": 0,
    "msg": "",
    "data": {
        "id": 4
    },
    "requestID": "630922f7-a6a8-4ebf-ac64-d6367bc254c9"
}

修改

PUT /note

Param

  • noteID (int) 记录ID
  • title (string) 标题
  • detail (string) 详情

Return

  • code (int) 请求返回码,一般0表示正常,非0表示异常
  • msg (string) 信息,一般是出错时的描述信息
Param
{
    "noteID": 4,
    "title": "mod title",
    "detail": "mod detail"
}
Return
{
    "code": 0,
    "msg": "",
    "data": null,
    "requestID": "4fc5acae-33b8-42ef-9d5f-901d534b237f"
}

获取分页

GET /note/page

Param

  • title (string) 标题
  • detail (string) 详情
  • beginTime (int64) 开始时间
  • endTime (int64) 结束时间
  • pageIndex (int) 分页开始
  • pageSize (int) 分页大小

Return

  • code (int) 请求返回码,一般0表示正常,非0表示异常
  • msg (string) 信息,一般是出错时的描述信息
  • data (object)
    • total (int) 总数
    • list (object list) 列表
      • noteID (int) 笔记ID
      • userName (string) 用户名
      • title (string) 标题
      • detail (string) 详情
      • createdAt (int64) 创建时间
Param
beginTime=0&detail=&endTime=0&pageIndex=0&pageSize=10&title=
Return
{
    "code": 0,
    "msg": "",
    "data": {
        "total": 4,
        "list": [
            {
                "noteID": 4,
                "userName": "0",
                "title": "mod title",
                "detail": "mod detail",
                "createdAt": 1596964951
            },
            {
                "noteID": 3,
                "userName": "0",
                "title": "mod title",
                "detail": "mod detail",
                "createdAt": 1596964517
            },
            {
                "noteID": 2,
                "userName": "0",
                "title": "mod title",
                "detail": "mod detail",
                "createdAt": 1596962843
            },
            {
                "noteID": 1,
                "userName": "0",
                "title": "mod title",
                "detail": "mod detail",
                "createdAt": 1596962237
            }
        ]
    },
    "requestID": "133d2dec-f00c-4d66-a268-e81a7da5b96e"
}

获取详情

GET /note

Param

  • noteID (int)

Return

  • code (int) 请求返回码,一般0表示正常,非0表示异常
  • msg (string) 信息,一般是出错时的描述信息
  • data (object)
    • noteID (int) 笔记ID
    • userName (string) 用户名
    • title (string) 标题
    • detail (string) 详情
    • createdAt (int64) 创建时间
Param
noteID=4
Return
{
    "code": 0,
    "msg": "",
    "data": {
        "noteID": 4,
        "userName": "1",
        "title": "mod title",
        "detail": "mod detail",
        "createdAt": 1596964951
    },
    "requestID": "026d817a-ac99-4f1e-8215-ca987ccab448"
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Note

type Note struct {

	// 频率限制
	Limiter route.Limiter `rate:"Rate(0.25, 2)"`
	// contains filtered or unexported fields
}

Note 笔记

func (*Note) Add

func (n *Note) Add(ctx context.Context, p route.Param) (res route.Result, err error)

Add 添加

func (*Note) Del

func (n *Note) Del(ctx context.Context, p route.Param) (res route.Result, err error)

Del 删除

func (*Note) Get

func (n *Note) Get(ctx context.Context, p route.Param) (res route.Result, err error)

Get 获取

func (*Note) GetPage

func (n *Note) GetPage(ctx context.Context, p route.Param) (res route.Result, err error)

GetPage 获取分页

func (*Note) Mod

func (n *Note) Mod(ctx context.Context, p route.Param) (res route.Result, err error)

Mod 修改

Jump to

Keyboard shortcuts

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