v1

package
v0.0.0-...-66263c1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	Error string `json:"error"`
}

type ApiFunc

type ApiFunc func(http.ResponseWriter, *http.Request) error // signature of our handler

type ApiServer

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

func NewApiServer

func NewApiServer(listenAddr string, store Storage) *ApiServer

func (*ApiServer) Run

func (s *ApiServer) Run()

type ApiSuccess

type ApiSuccess struct {
	Success string `json:"success"`
}

type PostgresStore

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

func NewPostgresStore

func NewPostgresStore() (*PostgresStore, error)

func (*PostgresStore) AdminDeleteUserById

func (s *PostgresStore) AdminDeleteUserById(id int) error

func (*PostgresStore) AdminUpdateUserById

func (s *PostgresStore) AdminUpdateUserById(id int, user *models.AdminUpdateUser) error

func (*PostgresStore) DeleteUserById

func (s *PostgresStore) DeleteUserById(id int) error

func (*PostgresStore) GetUsers

func (s *PostgresStore) GetUsers() ([]*models.User, error)

func (*PostgresStore) GetUsersById

func (s *PostgresStore) GetUsersById(id int) (*models.User, error)

func (*PostgresStore) Init

func (s *PostgresStore) Init() error

func (*PostgresStore) UpdateLastLogin

func (s *PostgresStore) UpdateLastLogin(id int) error

func (*PostgresStore) UpdateUserById

func (s *PostgresStore) UpdateUserById(id int, user *models.UpdateUser) error

func (*PostgresStore) UserLogin

func (s *PostgresStore) UserLogin(username string) (*models.UserNhash, error)

func (*PostgresStore) UserSignUp

func (s *PostgresStore) UserSignUp(user *models.RegisterUser) error

type Storage

type Storage interface {
	UserSignUp(*models.RegisterUser) error
	UserLogin(string) (*models.UserNhash, error)
	AdminUpdateUserById(int, *models.AdminUpdateUser) error
	AdminDeleteUserById(int) error
	GetUsers() ([]*models.User, error)
	GetUsersById(int) (*models.User, error)
	DeleteUserById(int) error
	UpdateUserById(int, *models.UpdateUser) error
	UpdateLastLogin(int) error
}

creating new interface which handles all server related queries

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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