admin

package
v0.0.0-...-0b0eabc Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Admin

type Admin struct {
	Clock    clock.Clock
	Postgres postgres.Postgreser
	Logger   *slog.Logger
}

func (*Admin) ExtendSession

func (a *Admin) ExtendSession(token string) error

func (*Admin) Login

func (a *Admin) Login(username string, password string) (string, error)

func (*Admin) ValidateSession

func (a *Admin) ValidateSession(token string) (bool, error)

type Adminer

type Adminer interface {
	ExtendSession(token string) error
	Login(username string, password string) (string, error)
	ValidateSession(token string) (bool, error)
}

type ExtendSessionCall

type ExtendSessionCall struct {
	Token string
}

type ExtendSessionResponse

type ExtendSessionResponse struct {
	Error error
}

type LoginCall

type LoginCall struct {
	Username string
	Password string
}

type LoginResponse

type LoginResponse struct {
	Token string
	Error error
}

type MockAdmin

type MockAdmin struct {
	ExtendSessionCalls      []ExtendSessionCall
	ExtendSessionResponse   ExtendSessionResponse
	LoginCalls              []LoginCall
	LoginResponse           LoginResponse
	ValidateSessionCalls    []ValidateSessionCall
	ValidateSessionResponse ValidateSessionResponse
}

func InitMock

func InitMock() MockAdmin

func (*MockAdmin) ExtendSession

func (m *MockAdmin) ExtendSession(token string) error

func (*MockAdmin) Login

func (m *MockAdmin) Login(username string, password string) (string, error)

func (*MockAdmin) SetExtendSessionResponse

func (m *MockAdmin) SetExtendSessionResponse(response ExtendSessionResponse)

func (*MockAdmin) SetLoginResponse

func (m *MockAdmin) SetLoginResponse(response LoginResponse)

func (*MockAdmin) SetValidateSessionResponse

func (m *MockAdmin) SetValidateSessionResponse(response ValidateSessionResponse)

func (*MockAdmin) ValidateSession

func (m *MockAdmin) ValidateSession(token string) (bool, error)

type ValidateSessionCall

type ValidateSessionCall struct {
	Token string
}

type ValidateSessionResponse

type ValidateSessionResponse struct {
	Valid bool
	Error error
}

Jump to

Keyboard shortcuts

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