user

package
v0.0.0-...-f54e1bb Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: BSD-3-Clause Imports: 4 Imported by: 1

README

user

import "github.com/blueprint-uservices/blueprint/examples/train_ticket/workflow/user"

Package user provides an implementation of the UserService UserService uses a backend.NoSQLDatabase to store user data

Index

type User

type User struct {
    UserID       string
    Username     string
    Password     string
    Gender       int64
    DocumentType int64
    DocumentNum  string
    Email        string
}

type UserService

UserService manages the users in the application

type UserService interface {
    // Finds a user given `username`
    FindByUsername(ctx context.Context, username string) (User, error)
    // Finds a user ID given `userID`
    FindByUserID(ctx context.Context, userID string) (User, error)
    // Deletes a user with ID `userID`
    DeleteUser(ctx context.Context, userID string) error
    // Gets all users
    GetAllUsers(ctx context.Context) ([]User, error)
    // Saves a new user
    SaveUser(ctx context.Context, user User) error
    // Updates an existing user
    UpdateUser(ctx context.Context, user User) (bool, error)
}

type UserServiceImpl

Implementation of UserService

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

func NewUserServiceImpl
func NewUserServiceImpl(ctx context.Context, db backend.NoSQLDatabase) (*UserServiceImpl, error)

Creates and returns a UserService object

func (*UserServiceImpl) DeleteUser
func (u *UserServiceImpl) DeleteUser(ctx context.Context, userID string) error

func (*UserServiceImpl) FindByUserID
func (u *UserServiceImpl) FindByUserID(ctx context.Context, userID string) (User, error)

func (*UserServiceImpl) FindByUsername
func (u *UserServiceImpl) FindByUsername(ctx context.Context, username string) (User, error)

func (*UserServiceImpl) GetAllUsers
func (u *UserServiceImpl) GetAllUsers(ctx context.Context) ([]User, error)

func (*UserServiceImpl) SaveUser
func (u *UserServiceImpl) SaveUser(ctx context.Context, user User) error

func (*UserServiceImpl) UpdateUser
func (u *UserServiceImpl) UpdateUser(ctx context.Context, user User) (bool, error)

Generated by gomarkdoc

Documentation

Overview

Package user provides an implementation of the UserService UserService uses a backend.NoSQLDatabase to store user data

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	UserID       string
	Username     string
	Password     string
	Gender       int64
	DocumentType int64
	DocumentNum  string
	Email        string
}

type UserService

type UserService interface {
	// Finds a user given `username`
	FindByUsername(ctx context.Context, username string) (User, error)
	// Finds a user ID given `userID`
	FindByUserID(ctx context.Context, userID string) (User, error)
	// Deletes a user with ID `userID`
	DeleteUser(ctx context.Context, userID string) error
	// Gets all users
	GetAllUsers(ctx context.Context) ([]User, error)
	// Saves a new user
	SaveUser(ctx context.Context, user User) error
	// Updates an existing user
	UpdateUser(ctx context.Context, user User) (bool, error)
}

UserService manages the users in the application

type UserServiceImpl

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

Implementation of UserService

func NewUserServiceImpl

func NewUserServiceImpl(ctx context.Context, db backend.NoSQLDatabase) (*UserServiceImpl, error)

Creates and returns a UserService object

func (*UserServiceImpl) DeleteUser

func (u *UserServiceImpl) DeleteUser(ctx context.Context, userID string) error

func (*UserServiceImpl) FindByUserID

func (u *UserServiceImpl) FindByUserID(ctx context.Context, userID string) (User, error)

func (*UserServiceImpl) FindByUsername

func (u *UserServiceImpl) FindByUsername(ctx context.Context, username string) (User, error)

func (*UserServiceImpl) GetAllUsers

func (u *UserServiceImpl) GetAllUsers(ctx context.Context) ([]User, error)

func (*UserServiceImpl) SaveUser

func (u *UserServiceImpl) SaveUser(ctx context.Context, user User) error

func (*UserServiceImpl) UpdateUser

func (u *UserServiceImpl) UpdateUser(ctx context.Context, user User) (bool, error)

Jump to

Keyboard shortcuts

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