models

package
v0.0.0-...-996e6dd Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2016 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gist

type Gist struct {
	UUID string
}

Gist model

func (*Gist) AddSnippets

func (g *Gist) AddSnippets(snippets []map[string]string, userid string) bool

AddSnippets appends new compressed snippets.

func (*Gist) Exists

func (g *Gist) Exists() bool

Exists verifies the persistence level.

func (*Gist) GetSnippets

func (g *Gist) GetSnippets() map[string]map[string]string

GetSnippets returns all uncompressed snippets which are associated to self.

func (*Gist) SetupUUID

func (g *Gist) SetupUUID()

SetupUUID defines a new UUID unless set.

type User

type User struct {
	UUID           string
	Username       string
	PasswordDigest string
}

User model

func FindUserByName

func FindUserByName(name string) (User, error)

FindUserByName will look for a user and will return it available. Otherwise it returns an error.

func FindUserByUUID

func FindUserByUUID(uuid string) (User, error)

FindUserByUUID will look for a user and will return it available. Otherwise it returns an error.

func NewUser

func NewUser(username string, password string) User

NewUser returns new user instance

func (*User) Available

func (u *User) Available() bool

Available check if user is available.

func (*User) CreatedGists

func (u *User) CreatedGists() []string

CreatedGists returns a list with gist id's

func (*User) EncodedUsername

func (u *User) EncodedUsername() string

EncodedUsername encodes the username into base64 to prevent to handle each kind of username.

func (*User) EqualsPassword

func (u *User) EqualsPassword(password string) bool

EqualsPassword verifies password

func (*User) GetPasswordDigest

func (u *User) GetPasswordDigest() string

GetPasswordDigest returns the objects internal passwordDigest or prefetch them from datastore

func (*User) GetUUID

func (u *User) GetUUID() string

GetUUID returns the objects internal UUID or prefetch them from datastore

func (*User) GetUsername

func (u *User) GetUsername() string

GetUsername returns the objects internal username or prefetch them from datastore

func (*User) MarkGist

func (u *User) MarkGist(UUID string) bool

MarkGist marks a new gist

func (*User) MarkedGists

func (u *User) MarkedGists() []string

MarkedGists returns a list of marked gists.

func (*User) ResetUUID

func (u *User) ResetUUID() string

ResetUUID sets a new UUID to current user.

func (*User) Save

func (u *User) Save() bool

Save user by using current redis session to database.

func (*User) SetPassword

func (u *User) SetPassword(password string)

SetPassword calculates a bcrypt hash and updates objects PasswordDigest.

Jump to

Keyboard shortcuts

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