Documentation
¶
Index ¶
- func RegisterRoutes(h *NoteHandler, e *echo.Group)
- type BulkNoteOperationPayload
- type LinkedNote
- type NoteDeletePayload
- type NoteHandler
- func (h *NoteHandler) All(c echo.Context) error
- func (h *NoteHandler) BulkOperations(c echo.Context) error
- func (h *NoteHandler) Create(c echo.Context) error
- func (h *NoteHandler) Delete(c echo.Context) error
- func (h *NoteHandler) DeleteByTitle(c echo.Context) error
- func (h *NoteHandler) Read(c echo.Context) error
- func (h *NoteHandler) SearchNotes(c echo.Context) error
- func (h *NoteHandler) Update(c echo.Context) error
- func (h *NoteHandler) UpdateByTitle(c echo.Context) error
- func (h *NoteHandler) Validator() *validate.Validator
- type NoteOperation
- type NotePayload
- type NoteService
- func (s *NoteService) All(ctx context.Context, id int) ([]db.GetNotesByUserRow, error)
- func (s *NoteService) Create(ctx context.Context, payload NotePayload) (db.CreateNoteRow, error)
- func (s *NoteService) Delete(ctx context.Context, id int) error
- func (s *NoteService) DeleteByTitle(ctx context.Context, payload NoteDeletePayload) error
- func (s *NoteService) Read(ctx context.Context, id int) (db.GetNoteRow, error)
- func (s *NoteService) SearchNotes(ctx context.Context, vaultID pgtype.Int4, searchQuery string) ([]db.SearchNotesRow, error)
- func (s *NoteService) Update(id int, ctx context.Context, payload NotePayload) (db.UpdateNoteRow, error)
- func (s *NoteService) UpdateByTitle(ctx context.Context, payload NotePayload) (db.UpdateNoteByTitleRow, error)
- type NoteWithDetails
- type Tag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶
func RegisterRoutes( h *NoteHandler, e *echo.Group, )
Types ¶
type BulkNoteOperationPayload ¶
type BulkNoteOperationPayload struct {
Operations []NoteOperation `json:"operations"`
}
type LinkedNote ¶
type NoteDeletePayload ¶
type NoteHandler ¶
type NoteHandler struct {
// contains filtered or unexported fields
}
func NewNoteHandler ¶
func NewNoteHandler( cfg *config.Config, cache *cache.Cache, validator *validate.Validator, service *NoteService, ) *NoteHandler
func (*NoteHandler) BulkOperations ¶
func (h *NoteHandler) BulkOperations(c echo.Context) error
func (*NoteHandler) DeleteByTitle ¶
func (h *NoteHandler) DeleteByTitle(c echo.Context) error
func (*NoteHandler) SearchNotes ¶
func (h *NoteHandler) SearchNotes(c echo.Context) error
func (*NoteHandler) UpdateByTitle ¶
func (h *NoteHandler) UpdateByTitle(c echo.Context) error
func (*NoteHandler) Validator ¶
func (h *NoteHandler) Validator() *validate.Validator
type NoteOperation ¶
type NoteOperation struct {
Operation string `json:"operation"`
UpdatePayload *NotePayload `json:"update_payload,omitempty"`
DeletePayload *NoteDeletePayload `json:"delete_payload,omitempty"`
}
type NotePayload ¶
type NotePayload struct {
Title string `json:"title" validate:"required"`
NewTitle string `json:"new_title"`
Tags []string `json:"tags"`
UserID int32 `json:"user_id" validate:"required"`
VaultID int32 `json:"vault_id" validate:"required"`
Upstream *int32 `json:"upstream_id"`
Links []int32 `json:"links"`
Content string `json:"content" validate:"required"`
}
type NoteService ¶
type NoteService struct {
// contains filtered or unexported fields
}
func NewNoteService ¶
func NewNoteService(db *db.Queries) *NoteService
func (*NoteService) All ¶
func (s *NoteService) All(ctx context.Context, id int) ([]db.GetNotesByUserRow, error)
func (*NoteService) Create ¶
func (s *NoteService) Create( ctx context.Context, payload NotePayload, ) (db.CreateNoteRow, error)
func (*NoteService) DeleteByTitle ¶
func (s *NoteService) DeleteByTitle( ctx context.Context, payload NoteDeletePayload, ) error
func (*NoteService) Read ¶
func (s *NoteService) Read(ctx context.Context, id int) (db.GetNoteRow, error)
func (*NoteService) SearchNotes ¶
func (s *NoteService) SearchNotes( ctx context.Context, vaultID pgtype.Int4, searchQuery string, ) ([]db.SearchNotesRow, error)
func (*NoteService) Update ¶
func (s *NoteService) Update( id int, ctx context.Context, payload NotePayload, ) (db.UpdateNoteRow, error)
func (*NoteService) UpdateByTitle ¶
func (s *NoteService) UpdateByTitle( ctx context.Context, payload NotePayload, ) (db.UpdateNoteByTitleRow, error)
type NoteWithDetails ¶
type NoteWithDetails struct {
ID int32 `json:"id"`
Title string `json:"title"`
UserID pgtype.Int4 `json:"userId"`
VaultID pgtype.Int4 `json:"vaultId"`
Upstream pgtype.Int4 `json:"upstream"`
Content string `json:"content"`
CreatedAt pgtype.Timestamptz `json:"createdAt"`
UpdatedAt pgtype.Timestamptz `json:"updatedAt"`
Tags []Tag `json:"tags"`
LinkedNotes []LinkedNote `json:"linkedNotes"`
}
Click to show internal directories.
Click to hide internal directories.