Unverified Commit bdf0c442 authored by boojack's avatar boojack Committed by GitHub

chore: add `CreatedTs` field to `MemoCreate` (#1073)

parent 799fb058
......@@ -46,7 +46,8 @@ type Memo struct {
type MemoCreate struct {
// Standard fields
CreatorID int `json:"-"`
CreatorID int `json:"-"`
CreatedTs *int64 `json:"createdTs"`
// Domain specific fields
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}
placeholder := []string{"?", "?", "?"}
if v := create.CreatedTs; v != nil {
set, args, placeholder = append(set, "created_ts"), append(args, *v), append(placeholder, "?")
}
query := `
INSERT INTO memo (
` + strings.Join(set, ", ") + `
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment