auth

package
v0.0.0-...-b105b8e Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StatusAll = [4]string{
	StatusActive.String(),
	StatusUnconfirmed.String(),
}

StatusAll variable with all the status converted into string

Functions

func AddAdminRouter

func AddAdminRouter(method, route string)

AddAdminRouter add admin router

func AddPublicRouter

func AddPublicRouter(method, route string)

AddPublicRouter add public routers

func GetDb

func GetDb() (r *database.Database)

GetDb return the instance of database connection

Types

type AppModule

type AppModule struct{}
var App AppModule

func (AppModule) AfterStart

func (a AppModule) AfterStart()

func (AppModule) BeforeStart

func (a AppModule) BeforeStart()

func (AppModule) GetMiddlewares

func (a AppModule) GetMiddlewares() []func(http.Handler) http.Handler

func (AppModule) GetRouterGroup

func (a AppModule) GetRouterGroup() *[]rest.RouteGroup

func (AppModule) GetRouters

func (a AppModule) GetRouters() *[]rest.RouteGroup

func (AppModule) Register

func (a AppModule) Register(_ *grpc.Server)

type Dao

type Dao interface {
	Create(v Model) error
	Update(v Model) error
	Delete(v Model) error
	Find(v Query) ([]Model, error)
	FindByEmail(email string) (Model, error)
}

func NewDao

func NewDao() (Dao, error)

type DaoDatabase

type DaoDatabase struct{}

func (DaoDatabase) Create

func (d DaoDatabase) Create(v Model) error

func (DaoDatabase) Delete

func (d DaoDatabase) Delete(v Model) error

func (DaoDatabase) Find

func (d DaoDatabase) Find(_ Query) (r []Model, err error)

func (DaoDatabase) FindByEmail

func (d DaoDatabase) FindByEmail(email string) (r Model, err error)

func (DaoDatabase) Update

func (d DaoDatabase) Update(v Model) error

type Model

type Model struct {
	Id               string    `json:"id"`
	CreatedAt        time.Time `json:"createdAt,omitempty"`
	UpdatedAt        time.Time `json:"updatedAt,omitempty"`
	Status           Status    `json:"status,omitempty"`
	Name             string    `json:"name,omitempty"`
	Password         string    `json:"password,omitempty"`
	Email            string    `json:"email,omitempty"`
	Age              uint      `json:"age,omitempty"`
	ConfirmationCode string    `json:"confirmationCode,omitempty"`
}

Model structure to represent a user on the service, this model has to represent everything related to the user

func NewModel

func NewModel(name, email string) Model

NewModel factory to Create mew struct user model

func (Model) TableName

func (Model) TableName() string

type Query

type Query struct {
	Id    string
	Email string
}

type Service

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

func NewService

func NewService() (s Service, err error)

NewService factory to Create mew userService

func (*Service) Create

func (s *Service) Create(m *Model) (err error)

Create a new user, perform data parser, validations and persist

func (*Service) Delete

func (s *Service) Delete(id string) (err error)

Delete Delete e organization in the database and in the cloudStorage

func (*Service) Find

func (s *Service) Find(query Query) (r []Model, err error)

Find General function to query the models

func (*Service) Update

func (s *Service) Update(m *Model) (err error)

Update a user, perform parser and validation

type Status

type Status string
const (
	StatusActive      Status = "active"
	StatusUnconfirmed Status = "unconfirmed"
)

func (Status) String

func (u Status) String() string

Jump to

Keyboard shortcuts

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