aboutsummaryrefslogtreecommitdiff
path: root/pkg/database/repository/user.go
blob: 5b2e3869a6e3d2be7ffb5c0c947dc448cccf6a92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package repository

import "context"

type (
	User struct {
		ID       uint
		Username string
		Name     string
		IsAdmin  bool
		Path     string
	}

	UpdateUser struct {
		Username string
		Name     string
		IsAdmin  bool
		Path     string
	}

	CreateUser struct {
		Username string
		Name     string
		Password []byte
		IsAdmin  bool
		Path     string
	}

	UserRepository interface {
		Get(ctx context.Context, id uint) (*User, error)
		GetPathFromUserID(ctx context.Context, id uint) (string, error)
		List(ctx context.Context) ([]*User, error)
		Create(ctx context.Context, createUser *CreateUser) (uint, error)
		Update(ctx context.Context, id uint, updateUser *UpdateUser) error
		Delete(ctx context.Context, id uint) error
		UpdatePassword(ctx context.Context, id uint, password []byte) error
		Any(ctx context.Context) (bool, error)
	}
)