Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SQLiteUser ¶
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)
Click to show internal directories.
Click to hide internal directories.