Documentation
¶
Overview ¶
Package fileuser provides a file-based implementation of the UserStore interface.
Index ¶
- type Option
- type Store
- func (s *Store) Count(_ context.Context) (int64, error)
- func (s *Store) Create(_ context.Context, user *auth.User) error
- func (s *Store) Delete(_ context.Context, id string) error
- func (s *Store) GetByID(_ context.Context, id string) (*auth.User, error)
- func (s *Store) GetByUsername(ctx context.Context, username string) (*auth.User, error)
- func (s *Store) List(ctx context.Context) ([]*auth.User, error)
- func (s *Store) Update(_ context.Context, user *auth.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements auth.UserStore using the local filesystem. Users are stored as individual JSON files in the configured directory. Thread-safe through internal locking.
func New ¶
New creates a new file-based user store. New creates a file-backed Store that persists users as per-user JSON files in baseDir. The baseDir must be non-empty; provided Option functions are applied to the store. If baseDir does not exist it is created with directory permissions 0750, and an initial in-memory index is built from existing user files. Returns an error on invalid input, failure to create the directory, or failure to build the initial index.
func (*Store) GetByUsername ¶
GetByUsername retrieves a user by their username.