chore(go): use json instead of jsonapi

This commit is contained in:
email 2022-02-04 16:51:48 +08:00
parent a8f0c9a7b1
commit d6418f5ff9
16 changed files with 131 additions and 109 deletions

View File

@ -1,11 +1,11 @@
package api
type Login struct {
Name string `jsonapi:"attr,name"`
Password string `jsonapi:"attr,password"`
Name string `json:"name"`
Password string `json:"password"`
}
type Signup struct {
Name string `jsonapi:"attr,name"`
Password string `jsonapi:"attr,password"`
Name string `json:"name"`
Password string `json:"password"`
}

View File

@ -1,17 +1,17 @@
package api
type Memo struct {
Id int `jsonapi:"primary,memo"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
RowStatus string `jsonapi:"attr,rowStatus"`
Id int `json:"id"`
CreatedTs int64 `json:"createdTs"`
UpdatedTs int64 `json:"updatedTs"`
RowStatus string `json:"rowStatus"`
Content string `jsonapi:"attr,content"`
CreatorId int `jsonapi:"attr,creatorId"`
Content string `json:"content"`
CreatorId int `json:"creatorId"`
}
type MemoCreate struct {
Content string `jsonapi:"attr,content"`
Content string `json:"content"`
CreatorId int
}
@ -28,7 +28,7 @@ type MemoFind struct {
}
type MemoDelete struct {
Id *int `jsonapi:"primary,memo"`
Id *int `json:"id"`
CreatorId *int
}

View File

@ -1,31 +1,31 @@
package api
type Resource struct {
Id int `jsonapi:"primary,resource"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
Id int `json:"id"`
CreatedTs int64 `json:"createdTs"`
UpdatedTs int64 `json:"updatedTs"`
Filename string `jsonapi:"attr,filename"`
Blob []byte `jsonapi:"attr,blob"`
Type string `jsonapi:"attr,type"`
Size int64 `jsonapi:"attr,size"`
Filename string `json:"filename"`
Blob []byte `json:"blob"`
Type string `json:"type"`
Size int64 `json:"size"`
CreatorId int `jsonapi:"attr,creatorId"`
CreatorId int `json:"creatorId"`
}
type ResourceCreate struct {
Filename string `jsonapi:"attr,filename"`
Blob []byte `jsonapi:"attr,blob"`
Type string `jsonapi:"attr,type"`
Size int64 `jsonapi:"attr,size"`
Filename string `json:"filename"`
Blob []byte `json:"blob"`
Type string `json:"type"`
Size int64 `json:"size"`
CreatorId int `jsonapi:"attr,creatorId"`
CreatorId int
}
type ResourceFind struct {
Id *int
CreatorId *int
Filename *string
Id *int `json:"id"`
CreatorId *int `json:"creatorId"`
Filename *string `json:"filename"`
}
type ResourceDelete struct {

View File

@ -1,13 +1,13 @@
package api
type Shortcut struct {
Id int `jsonapi:"primary,shortcut"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
Id int `json:"id"`
CreatedTs int64 `json:"createdTs"`
UpdatedTs int64 `json:"updatedTs"`
Title string `jsonapi:"attr,title"`
Payload string `jsonapi:"attr,payload"`
PinnedTs int64 `jsonapi:"attr,pinnedTs"`
Title string `json:"title"`
Payload string `json:"payload"`
RowStatus string `json:"rowStatus"`
CreatorId int
}
@ -16,18 +16,16 @@ type ShortcutCreate struct {
CreatorId int
// Domain specific fields
Title string `jsonapi:"attr,title"`
Payload string `jsonapi:"attr,payload"`
Title string `json:"title"`
Payload string `json:"payload"`
}
type ShortcutPatch struct {
Id int
Title *string `jsonapi:"attr,title"`
Payload *string `jsonapi:"attr,payload"`
PinnedTs *int64
Pinned *bool `jsonapi:"attr,pinned"`
Title *string `json:"title"`
Payload *string `json:"payload"`
RowStatus *string `json:"rowStatus"`
}
type ShortcutFind struct {
@ -37,7 +35,7 @@ type ShortcutFind struct {
CreatorId *int
// Domain specific fields
Title *string `jsonapi:"attr,title"`
Title *string `json:"title"`
}
type ShortcutDelete struct {

View File

@ -1,19 +1,19 @@
package api
type User struct {
Id int `jsonapi:"primary,user"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
Id int `json:"id"`
CreatedTs int64 `json:"createdTs"`
UpdatedTs int64 `json:"updatedTs"`
OpenId string `jsonapi:"attr,openId"`
Name string `jsonapi:"attr,name"`
OpenId string `json:"openId"`
Name string `json:"name"`
Password string
}
type UserCreate struct {
OpenId string `jsonapi:"attr,openId"`
Name string `jsonapi:"attr,name"`
Password string `jsonapi:"attr,password"`
OpenId string `json:"openId"`
Name string `json:"name"`
Password string `json:"password"`
}
type UserPatch struct {
@ -21,18 +21,26 @@ type UserPatch struct {
OpenId *string
Name *string `jsonapi:"attr,name"`
Password *string `jsonapi:"attr,password"`
ResetOpenId *bool `jsonapi:"attr,resetOpenId"`
Name *string `json:"name"`
Password *string `json:"password"`
ResetOpenId *bool `json:"resetOpenId"`
}
type UserFind struct {
Id *int `jsonapi:"attr,id"`
Id *int `json:"id"`
Name *string `jsonapi:"attr,name"`
Name *string `json:"name"`
OpenId *string
}
type UserRenameCheck struct {
Name string `json:"name"`
}
type UserPasswordCheck struct {
Password string `json:"password"`
}
type UserService interface {
CreateUser(create *UserCreate) (*User, error)
PatchUser(patch *UserPatch) (*User, error)

1
go.mod
View File

@ -23,7 +23,6 @@ require (
)
require (
github.com/google/jsonapi v1.0.0
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/gorilla/sessions v1.2.1
github.com/labstack/echo-contrib v0.12.0

2
go.sum
View File

@ -133,8 +133,6 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/jsonapi v1.0.0 h1:qIGgO5Smu3yJmSs+QlvhQnrscdZfFhiV6S8ryJAglqU=
github.com/google/jsonapi v1.0.0/go.mod h1:YYHiRPJT8ARXGER8In9VuLv4qvLfDmA9ULQqptbLE4s=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=

View File

@ -1,19 +1,19 @@
package server
import (
"encoding/json"
"fmt"
"memos/api"
"memos/common"
"net/http"
"github.com/google/jsonapi"
"github.com/labstack/echo/v4"
)
func (s *Server) registerAuthRoutes(g *echo.Group) {
g.POST("/auth/login", func(c echo.Context) error {
login := &api.Login{}
if err := jsonapi.UnmarshalPayload(c.Request().Body, login); err != nil {
if err := json.NewDecoder(c.Request().Body).Decode(login); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted login request").SetInternal(err)
}
@ -40,7 +40,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, user); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(user); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal create user response").SetInternal(err)
}
@ -57,7 +57,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
})
g.POST("/auth/signup", func(c echo.Context) error {
signup := &api.Signup{}
if err := jsonapi.UnmarshalPayload(c.Request().Body, signup); err != nil {
if err := json.NewDecoder(c.Request().Body).Decode(signup); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted signup request").SetInternal(err)
}
@ -88,7 +88,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, user); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(user); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal create user response").SetInternal(err)
}

View File

@ -1,13 +1,13 @@
package server
import (
"encoding/json"
"fmt"
"memos/api"
"memos/common"
"net/http"
"strconv"
"github.com/google/jsonapi"
"github.com/labstack/echo/v4"
)
@ -17,7 +17,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
memoCreate := &api.MemoCreate{
CreatorId: userId,
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, memoCreate); err != nil {
if err := json.NewDecoder(c.Request().Body).Decode(memoCreate); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted post memo request").SetInternal(err)
}
@ -27,7 +27,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, memo); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(memo); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal memo response").SetInternal(err)
}
@ -42,7 +42,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
memoPatch := &api.MemoPatch{
Id: memoId,
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, memoPatch); err != nil {
if err := json.NewDecoder(c.Request().Body).Decode(memoPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch memo request").SetInternal(err)
}
@ -52,7 +52,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, memo); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(memo); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal memo response").SetInternal(err)
}
@ -69,7 +69,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(list); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal memo list response").SetInternal(err)
}
@ -93,7 +93,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, memo); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(memo); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal memo response").SetInternal(err)
}

View File

@ -1,13 +1,13 @@
package server
import (
"encoding/json"
"fmt"
"io/ioutil"
"memos/api"
"net/http"
"strconv"
"github.com/google/jsonapi"
"github.com/labstack/echo/v4"
)
@ -53,7 +53,7 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, resource); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(resource); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal shortcut response").SetInternal(err)
}
@ -70,7 +70,7 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(list); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal resource list response").SetInternal(err)
}

View File

@ -29,9 +29,10 @@ func NewServer() *Server {
e.HidePort = false
e.Use(middleware.StaticWithConfig(middleware.StaticConfig{
Root: "web/dist",
Browse: false,
HTML5: true,
Skipper: middleware.DefaultSkipper,
Root: "web/dist",
Browse: false,
HTML5: true,
}))
e.Use(session.Middleware(sessions.NewCookieStore([]byte(common.GenUUID()))))

View File

@ -1,13 +1,12 @@
package server
import (
"encoding/json"
"fmt"
"memos/api"
"net/http"
"strconv"
"time"
"github.com/google/jsonapi"
"github.com/labstack/echo/v4"
)
@ -17,7 +16,7 @@ func (s *Server) registerShortcutRoutes(g *echo.Group) {
shortcutCreate := &api.ShortcutCreate{
CreatorId: userId,
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, shortcutCreate); err != nil {
if err := json.NewDecoder(c.Request().Body).Decode(shortcutCreate); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted post shortcut request").SetInternal(err)
}
@ -27,7 +26,7 @@ func (s *Server) registerShortcutRoutes(g *echo.Group) {
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, shortcut); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(shortcut); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal shortcut response").SetInternal(err)
}
@ -42,25 +41,17 @@ func (s *Server) registerShortcutRoutes(g *echo.Group) {
shortcutPatch := &api.ShortcutPatch{
Id: shortcutId,
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, shortcutPatch); err != nil {
if err := json.NewDecoder(c.Request().Body).Decode(shortcutPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch shortcut request").SetInternal(err)
}
if shortcutPatch.Pinned != nil {
pinnedTs := int64(0)
if *shortcutPatch.Pinned {
pinnedTs = time.Now().Unix()
}
shortcutPatch.PinnedTs = &pinnedTs
}
shortcut, err := s.ShortcutService.PatchShortcut(shortcutPatch)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to patch shortcut").SetInternal(err)
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, shortcut); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(shortcut); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal shortcut response").SetInternal(err)
}
@ -71,13 +62,13 @@ func (s *Server) registerShortcutRoutes(g *echo.Group) {
shortcutFind := &api.ShortcutFind{
CreatorId: &userId,
}
list, err := s.ShortcutService.FindShortcut(shortcutFind)
list, err := s.ShortcutService.FindShortcutList(shortcutFind)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch shortcut list").SetInternal(err)
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(list); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal shortcut list response").SetInternal(err)
}
@ -98,7 +89,7 @@ func (s *Server) registerShortcutRoutes(g *echo.Group) {
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, shortcut); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(shortcut); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal shortcut response").SetInternal(err)
}

View File

@ -1,11 +1,11 @@
package server
import (
"encoding/json"
"memos/api"
"memos/common"
"net/http"
"github.com/google/jsonapi"
"github.com/labstack/echo/v4"
)
@ -21,9 +21,35 @@ func (s *Server) registerUserRoutes(g *echo.Group) {
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, user); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(user); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal user response").SetInternal(err)
}
return nil
})
g.POST("/user/rename_check", func(c echo.Context) error {
userRenameCheck := &api.UserRenameCheck{}
if err := json.NewDecoder(c.Request().Body).Decode(userRenameCheck); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted post user rename check request").SetInternal(err)
}
if userRenameCheck.Name == "" {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted post user rename check request")
}
userFind := &api.UserFind{
Name: &userRenameCheck.Name,
}
user, err := s.UserService.FindUser(userFind)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find user").SetInternal(err)
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := json.NewEncoder(c.Response().Writer).Encode(user); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal user response").SetInternal(err)
}
return nil
})
g.PATCH("user/me", func(c echo.Context) error {
@ -31,7 +57,7 @@ func (s *Server) registerUserRoutes(g *echo.Group) {
userPatch := &api.UserPatch{
Id: userId,
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, userPatch); err != nil {
if err := json.NewDecoder(c.Request().Body).Decode(userPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch user request").SetInternal(err)
}
@ -46,7 +72,7 @@ func (s *Server) registerUserRoutes(g *echo.Group) {
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, user); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(user); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal user response").SetInternal(err)
}

View File

@ -1,12 +1,12 @@
package server
import (
"encoding/json"
"fmt"
"memos/api"
"net/http"
"strconv"
"github.com/google/jsonapi"
"github.com/labstack/echo/v4"
)
@ -31,7 +31,7 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
memoCreate := &api.MemoCreate{
CreatorId: user.Id,
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, memoCreate); err != nil {
if err := json.NewDecoder(c.Request().Body).Decode(memoCreate); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted post memo request by open api").SetInternal(err)
}
@ -41,7 +41,7 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, memo); err != nil {
if err := json.NewEncoder(c.Response().Writer).Encode(memo); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal memo response").SetInternal(err)
}

View File

@ -64,7 +64,8 @@ CREATE TABLE shortcut (
title TEXT NOT NULL DEFAULT '',
payload TEXT NOT NULL DEFAULT '',
creator_id INTEGER NOT NULL,
pinned_ts BIGINT NOT NULL DEFAULT 0,
-- allowed row status are 'NORMAL', 'ARCHIVED'.
row_status TEXT NOT NULL DEFAULT 'NORMAL',
FOREIGN KEY(creator_id) REFERENCES users(id)
);

View File

@ -72,7 +72,7 @@ func createShortcut(db *DB, create *api.ShortcutCreate) (*api.Shortcut, error) {
creator_id,
)
VALUES (?, ?, ?)
RETURNING id, title, payload, creator_id, created_ts, updated_ts, pinned_ts
RETURNING id, title, payload, creator_id, created_ts, updated_ts, row_status
`,
create.Title,
create.Payload,
@ -93,7 +93,7 @@ func createShortcut(db *DB, create *api.ShortcutCreate) (*api.Shortcut, error) {
&shortcut.CreatorId,
&shortcut.CreatedTs,
&shortcut.UpdatedTs,
&shortcut.PinnedTs,
&shortcut.RowStatus,
); err != nil {
return nil, FormatError(err)
}
@ -109,8 +109,8 @@ func patchShortcut(db *DB, patch *api.ShortcutPatch) (*api.Shortcut, error) {
if v := patch.Payload; v != nil {
set, args = append(set, "payload = ?"), append(args, *v)
}
if v := patch.PinnedTs; v != nil {
set, args = append(set, "pinned_ts = ?"), append(args, *v)
if v := patch.RowStatus; v != nil {
set, args = append(set, "row_status = ?"), append(args, *v)
}
args = append(args, patch.Id)
@ -119,7 +119,7 @@ func patchShortcut(db *DB, patch *api.ShortcutPatch) (*api.Shortcut, error) {
UPDATE shortcut
SET `+strings.Join(set, ", ")+`
WHERE id = ?
RETURNING id, title, payload, created_ts, updated_ts, pinned_ts
RETURNING id, title, payload, created_ts, updated_ts, row_status
`, args...)
if err != nil {
return nil, FormatError(err)
@ -137,7 +137,7 @@ func patchShortcut(db *DB, patch *api.ShortcutPatch) (*api.Shortcut, error) {
&shortcut.Payload,
&shortcut.CreatedTs,
&shortcut.UpdatedTs,
&shortcut.PinnedTs,
&shortcut.RowStatus,
); err != nil {
return nil, FormatError(err)
}
@ -166,7 +166,7 @@ func findShortcutList(db *DB, find *api.ShortcutFind) ([]*api.Shortcut, error) {
creator_id,
created_ts,
updated_ts,
pinned_ts
row_status
FROM shortcut
WHERE `+strings.Join(where, " AND "),
args...,
@ -186,7 +186,7 @@ func findShortcutList(db *DB, find *api.ShortcutFind) ([]*api.Shortcut, error) {
&shortcut.CreatorId,
&shortcut.CreatedTs,
&shortcut.UpdatedTs,
&shortcut.PinnedTs,
&shortcut.RowStatus,
); err != nil {
return nil, FormatError(err)
}