SQLiteUser

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQLiteUser

type SQLiteUser struct {
	sqlite3.SQLite3
}

func New

func New() (referenceInicialized *SQLiteUser, err error)

func (*SQLiteUser) GetByEmail

func (e *SQLiteUser) GetByEmail(mail string) (user dataFormat.User, err error)

GetByEmail (Português): Retorna o menu escolhido dentro do formato do datasource

Example
var err error
var user dataFormat.User
var userAsByte []byte

var sqlUser = SQLiteUser{}
err = sqlUser.Connect(consts.KDatabaseName)
if err != nil {
	log.Fatalf("sqlUser.Connect().error: %v", err.Error())
}

err = sqlUser.Install()
if err != nil {
	log.Fatalf("sqlUser.Install().error: %v", err.Error())
}

var found bool
found, err = sqlUser.MailExists("helmut.kemper@gmail.com")
if err != nil {
	log.Fatalf("sqlUser.MailExists().error: %v", err.Error())
}

if found == false {
	log.Fatal("sqlUser.MailExists().found: false")
}

user, err = sqlUser.GetByEmail("helmut.kemper@gmail.com")
if err != nil {
	log.Fatalf("sqlUser.GetMainMenu().error: %v", err.Error())
}

userAsByte, err = json.Marshal(&user)
if err != nil {
	log.Fatalf("json.Marshal().error: %v", err.Error())
}

fmt.Printf("%s", userAsByte)

err = os.Remove(consts.KDatabaseName)
if err != nil {
	log.Fatalf("os.Remove().error: %v", err.Error())
}
Output:

{"id":"24867707-3a21-4368-8058-3d7b1ddb8c06","manuId":"5996b891-9d3c-4038-af37-cb07f5f0f72d","admin":1,"name":"Helmut Kemper","nickname":"Kemper","mail":"helmut.kemper@gmail.com"}

func (*SQLiteUser) Install

func (e *SQLiteUser) Install() (err error)

Install (Português): Instala o menu e popula os primeiros dados.

func (*SQLiteUser) MailExists

func (e *SQLiteUser) MailExists(mail string) (found bool, err error)

func (*SQLiteUser) Set

func (e *SQLiteUser) Set(id string, admin int, name, nickName, email, password string) (err error)

Set (Português): Adiciona um novo usuário

Jump to

Keyboard shortcuts

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