fixed lint + fmt
This commit is contained in:
@ -128,9 +128,8 @@ func (err ErrIDCannotBeZero) Error() string {
|
||||
// List errors
|
||||
// ===========
|
||||
|
||||
|
||||
// ErrListDoesNotExist represents a "ErrListDoesNotExist" kind of error. Used if the list does not exist.
|
||||
type ErrListDoesNotExist struct{
|
||||
type ErrListDoesNotExist struct {
|
||||
ID int64
|
||||
}
|
||||
|
||||
@ -142,4 +141,4 @@ func IsErrListDoesNotExist(err error) bool {
|
||||
|
||||
func (err ErrListDoesNotExist) Error() string {
|
||||
return fmt.Sprintf("List does not exist [ID: %d]", err.ID)
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package models
|
||||
|
||||
// List represents a list of items
|
||||
type List struct {
|
||||
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"`
|
||||
Title string `xorm:"varchar(250)" json:"title"`
|
||||
@ -10,7 +11,8 @@ type List struct {
|
||||
Updated int64 `xorm:"updated" json:"updated"`
|
||||
}
|
||||
|
||||
func GetListByID(id int64) (list List, err error){
|
||||
// GetListByID returns a list by its ID
|
||||
func GetListByID(id int64) (list List, err error) {
|
||||
list.ID = id
|
||||
exists, err := x.Get(&list)
|
||||
if err != nil {
|
||||
@ -32,6 +34,7 @@ func GetListByID(id int64) (list List, err error){
|
||||
return list, nil
|
||||
}
|
||||
|
||||
// CreateOrUpdateList updates a list or creates it if it doesn't exist
|
||||
func CreateOrUpdateList(list *List) (err error) {
|
||||
// Check if it exists
|
||||
_, err = GetListByID(list.ID)
|
||||
|
Reference in New Issue
Block a user