data

package
v0.0.0-...-23016c8 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SecretNote

type SecretNote struct {
	ID       string `json:"id"`
	Username string `json:"username"`
	Text     string `json:"text"`
}

type SecretNoteService

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

SecretNoteService maintains the user notes.

func NewSecretNoteService

func NewSecretNoteService(dbService db.DatabaseService) *SecretNoteService

NewSecretNoteService creates a SecretNoteService that is ready to use.

func (*SecretNoteService) Add

func (ns *SecretNoteService) Add(user string, n SecretNote) error

Add adds a new SecretNote for the given user by using the SecretNoteService.

func (*SecretNoteService) GetAll

func (ns *SecretNoteService) GetAll(user string) ([]SecretNote, error)

Get returns all the SecretNotes of a given user by using the SecretNoteService.

type User

type User struct {
	Username, Password string
}

type UserService

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

UserService holds

func NewUserService

func NewUserService(dbService db.DatabaseService) *UserService

NewUserService creates a ready to use user service.

func (*UserService) Add

func (us *UserService) Add(name, password string) error

Add validates a user password and creates a new user.

func (*UserService) ValidatePassword

func (us *UserService) ValidatePassword(name, providedPwd string) error

ValidatePassword checks the provided password of an existing user.

func (*UserService) ValidateUser

func (us *UserService) ValidateUser(name string) error

ValidateUser checks the provided username belongs to an existing user.

Jump to

Keyboard shortcuts

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