datastore

package
v0.0.0-...-ec4765f Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

datastore package auth.go - datastore layer for authentification

package datastore user.go - implementing standar CRUD operation for user NOTE of method:

  • Get method
  • Gets method
  • Update method
  • Delete method
  • CheckCredential for login/signin operation
  • UserActivation method
  • UserExist method

package datastore user.role.go - implementing standar CRUD operation for user.role

datastore package user.status.go - read only persistent/ datastore layer for user.status model

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IUserRoleStore

type IUserRoleStore interface {
	// Create will execute sql query insert new user record into database
	Create(input d.UserRole) (*d.UserRole, error)

	// Get will execute sql query to get user record from database
	// based on the given id
	Get(id int) (*d.UserRole, error)

	// Gets will execute sql query to get all user record from database
	Gets() ([]*d.UserRole, error)

	// Update will execute sql query to update user record
	// based on given input id and input data
	Update(id int, input d.UserRole) (*d.UserRole, error)

	// Delete will do 'soft delete' instead of deleting the user record
	// from the database. Data should be persistant in the database
	Delete(id int) (*d.UserRole, error)
}

IUserRoleStore is user.role interface for CRUD operation directly to the database

type IUserStatusStore

type IUserStatusStore interface {
	// Get will execute sql query to get user record from database
	// based on the given id
	Get(id int) (*d.UserStatus, error)

	// Gets will execute sql query to get all user record from database
	Gets() ([]*d.UserStatus, error)
}

IUserStatusStores is user.status interface for 'Read' / 'Get' operation directly to the database

type IUserStore

type IUserStore interface {
	// Create will execute sql query to insert new user record into the database
	Create(input d.User) (*d.User, error)

	// Get will execute sql query to get user record from database
	// based on the given id
	Get(id uuid.UUID) (*d.User, error)

	// GetByEmail will get credential data by email from user record
	GetByEmail(email string) (*d.UserCredential, error)

	// Gets will execute sql query to get all user record from database
	Gets() ([]*d.User, error)

	// Update will execute sql query to update user record
	// based on given input id and input data
	Update(id uuid.UUID, input d.User) (*d.User, error)

	// Delete will do 'soft delete' instead of deleting the user record
	// from the database. Data should be persistant in the database
	Delete(id uuid.UUID) (*d.User, error)

	// GetCredential will get credential data from user record
	GetCredential(username, passkey string) (*d.UserCredential, error)

	// IsUserExist will check whether username/ email is already exist
	IsUserExist(username, email string) (bool, error)
}

IUserStore is user interface for CRUD operation directly to the database

type UserRoleStore

type UserRoleStore struct {
	// DB is instance of IDatabase interface
	DB database.IDatabase
}

UserRoleStore is instance wrapper for IDatabase interface

func NewUserRoleStore

func NewUserRoleStore(iDB database.IDatabase) *UserRoleStore

NewUserRoleStore will create instance of UserRoleStore

func (*UserRoleStore) Create

func (st *UserRoleStore) Create(input d.UserRole) (*d.UserRole, error)

Create will insert new user.role record data into the database

func (*UserRoleStore) Delete

func (st *UserRoleStore) Delete(id int) (*d.UserRole, error)

Delete will 'soft' delete user role record data based on its given 'id'

func (*UserRoleStore) Get

func (st *UserRoleStore) Get(id int) (*d.UserRole, error)

Get will get user.role record from the database based on its 'id'

func (*UserRoleStore) Gets

func (st *UserRoleStore) Gets() ([]*d.UserRole, error)

Gets will get all user.role record from the database

func (*UserRoleStore) Update

func (st *UserRoleStore) Update(id int, input d.UserRole) (*d.UserRole, error)

Update will update user.role record based it 'id' with given new record value

type UserStatusStore

type UserStatusStore struct {
	// DB is instance of IDatabase interface
	DB database.IDatabase
}

UserStatusStore is instance wrapper for IDatabase interface

func NewUserStatusStore

func NewUserStatusStore(iDB database.IDatabase) *UserStatusStore

NewUseStatusStore will create instance of UserStatusStore

func (*UserStatusStore) Get

func (s *UserStatusStore) Get(id int) (*d.UserStatus, error)

Get will get user.status from the database based on its 'id'

func (*UserStatusStore) Gets

func (s *UserStatusStore) Gets() ([]*d.UserStatus, error)

Gets will get all user.status record from the database

type UserStore

type UserStore struct {
	// DB is IDatabase interface instance
	DB database.IDatabase
}

UserStore is instance wrapper for IDatabase interface

func NewUserStore

func NewUserStore(iDB database.IDatabase) *UserStore

NewUserStore will create instance of UserStore

func (*UserStore) Create

func (st *UserStore) Create(input d.User) (*d.User, error)

Create will create new User record to database

func (*UserStore) Delete

func (st *UserStore) Delete(id uuid.UUID) (*d.User, error)

Delete will delete user record based on given id

func (*UserStore) Get

func (st *UserStore) Get(id uuid.UUID) (*d.User, error)

Get will get user data from database

func (*UserStore) GetByEmail

func (st *UserStore) GetByEmail(email string) (*d.UserCredential, error)

GetByEmail will get user credential by username

func (*UserStore) GetCredential

func (st *UserStore) GetCredential(username, passkey string) (*d.UserCredential, error)

GetCredential will get user credential data

func (*UserStore) Gets

func (st *UserStore) Gets() ([]*d.User, error)

Gets will get all user data from database

func (*UserStore) IsUserExist

func (st *UserStore) IsUserExist(username, email string) (bool, error)

UserExist will check whether username/ email already exist

func (*UserStore) Update

func (st *UserStore) Update(id uuid.UUID, input d.User) (*d.User, error)

Update will update user based on given id

Jump to

Keyboard shortcuts

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