Documentation ¶
Index ¶
- Variables
- func HandlePSQLError(err error) error
- type User
- type UserMemoryStorage
- func (s *UserMemoryStorage) CreateUser(ctx context.Context, u User) (string, error)
- func (s *UserMemoryStorage) DeleteUser(ctx context.Context, id string) error
- func (s *UserMemoryStorage) GetUser(ctx context.Context, id string) (User, error)
- func (s *UserMemoryStorage) ListUser(ctx context.Context) ([]User, error)
- func (s *UserMemoryStorage) UpdateUser(ctx context.Context, u User) error
- type UserPostgresStorage
- func (s *UserPostgresStorage) CreateUser(ctx context.Context, u User) (string, error)
- func (s *UserPostgresStorage) DeleteUser(ctx context.Context, id string) error
- func (s *UserPostgresStorage) GetUser(ctx context.Context, id string) (User, error)
- func (s *UserPostgresStorage) ListUser(ctx context.Context) ([]User, error)
- func (s *UserPostgresStorage) UpdateUser(ctx context.Context, u User) error
- type UserStorage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrAlreadyExists ErrAlreadyExists ErrAlreadyExists = errors.New("object already exists") // ErrDoesNotExist ErrDoesNotExist ErrDoesNotExist = errors.New("object does not exist") )
Functions ¶
func HandlePSQLError ¶
HandlePSQLError handlePSQLError https://github.com/brocaar/lora-app-server/blob/master/internal/storage/errors.go#L41
Types ¶
type User ¶
type User struct { ID string `db:"id"` Username string `db:"username" gdb_i:"-" gdb_u:"-"` Password string `db:"password" gdb_i:"-" gdb_u:"-"` State uint32 `db:"state" gdb_i:"-" gdb_u:"-"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
User User
type UserMemoryStorage ¶
type UserMemoryStorage struct {
// contains filtered or unexported fields
}
UserMemoryStorage UserMemoryStorage
func NewUserMemoryStorage ¶
func NewUserMemoryStorage() *UserMemoryStorage
NewUserMemoryStorage NewUserMemoryStorage
func (*UserMemoryStorage) CreateUser ¶
CreateUser CreateUser
func (*UserMemoryStorage) DeleteUser ¶
func (s *UserMemoryStorage) DeleteUser(ctx context.Context, id string) error
DeleteUser DeleteUser
func (*UserMemoryStorage) ListUser ¶
func (s *UserMemoryStorage) ListUser(ctx context.Context) ([]User, error)
ListUser ListUser
func (*UserMemoryStorage) UpdateUser ¶
func (s *UserMemoryStorage) UpdateUser(ctx context.Context, u User) error
UpdateUser UpdateUser
type UserPostgresStorage ¶
type UserPostgresStorage struct {
// contains filtered or unexported fields
}
UserPostgresStorage UserPostgresStorage
func NewUserPostgresStorage ¶
func NewUserPostgresStorage() *UserPostgresStorage
NewUserPostgresStorage NewUserPostgresStorage
func (*UserPostgresStorage) CreateUser ¶
CreateUser CreateUser
func (*UserPostgresStorage) DeleteUser ¶
func (s *UserPostgresStorage) DeleteUser(ctx context.Context, id string) error
DeleteUser DeleteUser
func (*UserPostgresStorage) ListUser ¶
func (s *UserPostgresStorage) ListUser(ctx context.Context) ([]User, error)
ListUser ListUser
func (*UserPostgresStorage) UpdateUser ¶
func (s *UserPostgresStorage) UpdateUser(ctx context.Context, u User) error
UpdateUser UpdateUser
type UserStorage ¶
type UserStorage interface { ListUser(ctx context.Context) ([]User, error) GetUser(ctx context.Context, id string) (User, error) CreateUser(ctx context.Context, u User) (string, error) UpdateUser(ctx context.Context, u User) error DeleteUser(ctx context.Context, id string) error }
UserStorage UserStorage
Click to show internal directories.
Click to hide internal directories.