Initial import with modified Dockerfile for env-based config generation
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package storage
|
||||
|
||||
import "context"
|
||||
|
||||
// Repository defines the interface for user storage operations
|
||||
// This abstraction allows swapping SQLite for PostgreSQL or other databases
|
||||
type Repository interface {
|
||||
// User operations
|
||||
GetUserByEmail(ctx context.Context, email string) (*User, error)
|
||||
GetUserByGiteaUsername(ctx context.Context, username string) (*User, error)
|
||||
GetUserBySlackID(ctx context.Context, slackID string) (*User, error)
|
||||
UpsertUser(ctx context.Context, user *User) error
|
||||
ListUsers(ctx context.Context) ([]*User, error)
|
||||
|
||||
// Migrations
|
||||
Migrate(ctx context.Context) error
|
||||
|
||||
// Close the connection
|
||||
Close() error
|
||||
}
|
||||
|
||||
// ErrNotFound is returned when a user is not found
|
||||
type ErrNotFound struct {
|
||||
Message string
|
||||
}
|
||||
|
||||
func (e *ErrNotFound) Error() string {
|
||||
return e.Message
|
||||
}
|
||||
|
||||
// IsNotFound checks if an error is a not found error
|
||||
func IsNotFound(err error) bool {
|
||||
_, ok := err.(*ErrNotFound)
|
||||
return ok
|
||||
}
|
||||
Reference in New Issue
Block a user