mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: add CreatedTs
field to MemoCreate
(#1073)
This commit is contained in:
@@ -47,6 +47,7 @@ type Memo struct {
|
|||||||
type MemoCreate struct {
|
type MemoCreate struct {
|
||||||
// Standard fields
|
// Standard fields
|
||||||
CreatorID int `json:"-"`
|
CreatorID int `json:"-"`
|
||||||
|
CreatedTs *int64 `json:"createdTs"`
|
||||||
|
|
||||||
// Domain specific fields
|
// Domain specific fields
|
||||||
Visibility Visibility `json:"visibility"`
|
Visibility Visibility `json:"visibility"`
|
||||||
|
@@ -217,6 +217,10 @@ func createMemoRaw(ctx context.Context, tx *sql.Tx, create *api.MemoCreate) (*me
|
|||||||
args := []interface{}{create.CreatorID, create.Content, create.Visibility}
|
args := []interface{}{create.CreatorID, create.Content, create.Visibility}
|
||||||
placeholder := []string{"?", "?", "?"}
|
placeholder := []string{"?", "?", "?"}
|
||||||
|
|
||||||
|
if v := create.CreatedTs; v != nil {
|
||||||
|
set, args, placeholder = append(set, "created_ts"), append(args, *v), append(placeholder, "?")
|
||||||
|
}
|
||||||
|
|
||||||
query := `
|
query := `
|
||||||
INSERT INTO memo (
|
INSERT INTO memo (
|
||||||
` + strings.Join(set, ", ") + `
|
` + strings.Join(set, ", ") + `
|
||||||
|
Reference in New Issue
Block a user