Add login

This commit is contained in:
2020-01-05 23:20:38 +01:00
parent dc396a300f
commit c0926ffea0
35 changed files with 1647 additions and 39 deletions

32
storage/dao/database_error.go Executable file
View File

@@ -0,0 +1,32 @@
package dao
import (
"fmt"
)
type Type int
const (
ErrTypeNotFound Type = iota
ErrTypeDuplicate
ErrTypeForeignKeyViolation
)
type DAOError struct {
Cause error
Type Type
}
func NewDAOError(t Type, cause error) error {
return &DAOError{
Type: t,
Cause: cause,
}
}
func (e *DAOError) Error() string {
if e.Cause != nil {
return fmt.Sprintf("Type %d: %s", e.Type, e.Cause.Error())
}
return fmt.Sprintf("Type %d: no cause given", e.Type)
}