service

package
v0.0.0-...-d933f62 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package service implement the services required by the rest package

Package service implement the services required by the rest package

Package service implement the services required by the rest package

Package service implement the services required by the rest package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(repo RepoInterface) *service

New return a new service instance

Types

type Entity

type Entity struct {
	ID        uint `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	Email     string `gorm:"NOT NULL;UNIQUE"`
	Username  string
	Password  string `gorm:"NOT NULL"`
}

Entity is the model of a user in the database

func (Entity) TableName

func (Entity) TableName() string

TableName allow to gives a specific name to the user table

type RepoInterface

type RepoInterface interface {
	Create(user Entity) bool
	FindByID(id uint) (user Entity, err error)
	FindByEmail(email string) (user Entity, err error)
	Update(user Entity) error
	Delete(user Entity) error
}

RepoInterface is the model for the repo package of user

Jump to

Keyboard shortcuts

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