user

package
v0.0.0-...-f9e2064 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

*

  • Copyright (c) 2019 Andreas Bauer *
  • SPDX-License-Identifier: MIT

*

  • Copyright (c) 2019 Andreas Bauer *
  • SPDX-License-Identifier: MIT

*

  • Copyright (c) 2019 Andreas Bauer *
  • SPDX-License-Identifier: MIT

*

  • Copyright (c) 2019 Andreas Bauer *
  • SPDX-License-Identifier: MIT

Index

Constants

View Source
const (
	ADMIN  = "ADMIN"
	PUBLIC = "PUBLIC"
)

Variables

View Source
var Roles = [...]string{ADMIN, PUBLIC}

Functions

This section is empty.

Types

type Repository

type Repository interface {
	FindAll() (result []*User, err error)
	FindByEmail(email string) (*User, error)
	Delete(email string) (err error)
	Save(*User) (err error)
}

type Service

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

Service service interface

func NewService

func NewService(r Repository) *Service

NewService create new service

func (*Service) Delete

func (s *Service) Delete(email string) error

Delete user with given email address.

func (*Service) FindAll

func (s *Service) FindAll() ([]*User, error)

Find all user.

func (*Service) FindByEmail

func (s *Service) FindByEmail(email string) (*User, error)

Find user by its email address.

func (*Service) Save

func (s *Service) Save(user *User) error

Store user and hash its password.

type User

type User struct {
	Name     string `json: "name"`
	Email    string `json: "email"`
	Password string `json: "password"`
	Role     string `json: "role"`
}

Jump to

Keyboard shortcuts

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