auth

package
v0.0.0-...-2680af6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRoleParams

type CreateRoleParams struct {
	RoleName    string
	Description string
}

type CreateUserParams

type CreateUserParams struct {
	UserName  string
	Password  string
	Email     string
	FirstName string
	LastName  string
	Status    string
}

type Role

type Role struct {
	RoleID      int64
	RoleName    string
	Description string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Status      string
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(db *pgxpool.Pool) *Store

func (*Store) CreateRole

func (s *Store) CreateRole(ctx context.Context, p CreateRoleParams) (int64, error)

func (*Store) CreateUser

func (s *Store) CreateUser(ctx context.Context, p CreateUserParams) (int64, error)

func (*Store) CreateUserRole

func (s *Store) CreateUserRole(ctx context.Context, userID, roleID int64) (int64, error)

func (*Store) FetchUserWithRole

func (s *Store) FetchUserWithRole(ctx context.Context, userID int64) (UserWithRoles, error)

func (*Store) FindUserByID

func (s *Store) FindUserByID(ctx context.Context, id int64) (User, error)

func (*Store) FindUserByNameAndPassword

func (s *Store) FindUserByNameAndPassword(ctx context.Context, name, password string) (User, error)

func (*Store) UpdateUserStatus

func (s *Store) UpdateUserStatus(ctx context.Context, id int64, status string) error

type User

type User struct {
	UserID      int64
	UserName    string
	Password    string
	Email       string
	FirstName   string
	LastName    string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	LastLoginAt sql.NullTime
	Status      string
}

type UserRole

type UserRole struct {
	UserRoleID int64
	UserID     int64
	RoleID     int64
}

type UserWithRoles

type UserWithRoles struct {
	User
	Roles []Role
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL