gouser

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2022 License: MIT Imports: 5 Imported by: 0

README

gouser module

A simple GO module providing CRUD and match methods on a User "entity" stored locally as JSON.

Created for GO language learning purposes.

Once finished and tested, might be usefull for creating some sort of authentication and user management on a simple application withot adding a database layer.

setup

  1. download the module: go get github.com/lorenzo-piersante/gouser

  2. create a new directory in the root folder called "storage". User JSON representation will be stored in that directory.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteById

func DeleteById(id string) error

Delete a user from storage by searching for him/her by identifier (email)

func Match

func Match(id, password string) error

Return nil if email + password match a registered user

Types

type User

type User struct {
	Username, Password, Email string
}

func Create

func Create(username, password, email string) (*User, error)

Create a new User struct with hashed email

func Edit

func Edit(id string, username string, password string) (*User, error)

Edit username and password of the user with a specific id (email)

func GetAll

func GetAll() ([]User, error)

func GetById

func GetById(id string) (*User, error)

func (User) GetId

func (user User) GetId() string

Jump to

Keyboard shortcuts

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