In Mindflow interface renamed all methods that work with Post into *Post().
This commit is contained in:
parent
a8a7e6427d
commit
16e2ff6ebc
@ -244,7 +244,7 @@ func (h *MindflowApiHandlers) New(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
if err = h.db.New(post); err != nil {
|
||||
if err = h.db.NewPost(post); err != nil {
|
||||
InternalError(err.Error(), "Title: "+r.FormValue("title")+" | Body: "+r.FormValue("body"), w)
|
||||
return
|
||||
}
|
||||
@ -288,7 +288,7 @@ func (h *MindflowApiHandlers) Edit(w http.ResponseWriter, r *http.Request) {
|
||||
post.ID, _ = strconv.ParseInt(GetURLParam(r, "id"), 10, 64)
|
||||
}
|
||||
|
||||
if err = h.db.Edit(post); err != nil {
|
||||
if err = h.db.EditPost(post); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
@ -296,7 +296,7 @@ func (h *MindflowApiHandlers) Edit(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func (h *MindflowApiHandlers) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id, _ := strconv.ParseInt(GetURLParam(r, "id"), 10, 64)
|
||||
if err := h.db.Delete(id); err != nil {
|
||||
if err := h.db.DeletePost(id); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ func dsn(filePath string) string {
|
||||
return fmt.Sprintf("file:%s?_journal=WAL&_mutex=full", filePath)
|
||||
}
|
||||
|
||||
func (s *SQLiteMindflow) New(post *mindflow.Post) error {
|
||||
func (s *SQLiteMindflow) NewPost(post *mindflow.Post) error {
|
||||
tx, err := s.db.Begin()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -145,7 +145,7 @@ func (s *SQLiteMindflow) New(post *mindflow.Post) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SQLiteMindflow) Edit(post *mindflow.Post) error {
|
||||
func (s *SQLiteMindflow) EditPost(post *mindflow.Post) error {
|
||||
tx, err := s.db.Begin()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -162,7 +162,7 @@ func (s *SQLiteMindflow) Edit(post *mindflow.Post) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SQLiteMindflow) Delete(id int64) error {
|
||||
func (s *SQLiteMindflow) DeletePost(id int64) error {
|
||||
tx, err := s.db.Begin()
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -38,14 +38,14 @@ func (p *Post) PostID() string {
|
||||
}
|
||||
|
||||
type Mindflow interface {
|
||||
New(post *Post) error
|
||||
Edit(post *Post) error
|
||||
Delete(id int64) error
|
||||
NewPost(post *Post) error
|
||||
EditPost(post *Post) error
|
||||
DeletePost(id int64) error
|
||||
Posts() ([]Post, error)
|
||||
Categories() ([]Category, error)
|
||||
NewCategory(name string) (int64, error)
|
||||
EditCategory(category *Category) error
|
||||
DeleteCategory(id int64) error
|
||||
DeleteUnusedCategories() error
|
||||
Categories() ([]Category, error)
|
||||
Close() error
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user