database

package
v0.0.0-...-5c637e2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2013 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFeeds

func AddFeeds(uid []byte, cookie string, urls ...string) error

pushes update to user’s account.

func Update(userID []byte, delta *Delta) error {
	return nil
}

func AddUser

func AddUser(uid, pwd []byte, salt *sec.Salt, nick, email string) error

AddUser creates a new user and adds it to the database. It establishes that both the user does not exist and that their email is not in use

func Authenticate

func Authenticate(uid, pswd []byte) bool

Authenticate checks that the userID and password match.

func Backup

func Backup(path string) error

func Cache

func Cache(s string) error

func Console

func Console()

func Debug

func Debug() []byte

func DeleteUser

func DeleteUser(uid []byte) error

Delete user removes a user from the database provided they exist in the system

func Exists

func Exists(uid []byte) bool

Exists confirms whether or not a user exists in the system

func Feeds

func Feeds(uid []byte) ([]*rss.Feed, error)

retrieves feed info.

func FeedsToJson

func FeedsToJson(uid []byte, cookie string) ([]byte, error)

func Login

func Login(uid, pswd []byte) (string, time.Time, error)

Login logs a user into the system, returning the cookie string Authenticates the user first if user already has a valid cookie, returns that cookie as opposed to creating one

func Nickname

func Nickname(uid []byte, cookie string) (string, error)

Nickname validates the cookie and returns the user's nickname

func Reader

func Reader() io.Reader

func ResetUserFeeds

func ResetUserFeeds(uid []byte) error

removes all feeds from user’s account.

func Restore

func Restore(path string) error

func Salt

func Salt(email string) *sec.Salt

func StringToUid

func StringToUid(s string) ([]byte, error)

func UidToString

func UidToString(uid []byte) string

func UpdateNickname

func UpdateNickname(uid []byte, cookie string, nickname string) error

UpdateNickname updates a users nickname having first established the existence of a user and validated the cookie

func UpdatePassword

func UpdatePassword(uid, pwd, nPwd []byte) error

UpdatePassword changes the password of a given user

func Validate

func Validate(cookie string, uid []byte) (bool, string, time.Time)

Validate checks the cookie.

Types

type AuthenticationError

type AuthenticationError struct{}

func (AuthenticationError) Error

func (err AuthenticationError) Error() string

type BackupFailure

type BackupFailure struct{}

func (BackupFailure) Append

func (b BackupFailure) Append(err error) error

func (BackupFailure) Error

func (err BackupFailure) Error() string

type CacheItem

type CacheItem struct {
	Path string
	Gzip bool
}

func Gzip

func Gzip(str string) *CacheItem
type Cookie struct {
	Exp     time.Time
	Replace time.Time
	Cookie  string
}

256 rand number

type CookieJar

type CookieJar []*Cookie

type Database

type Database struct{}

func (*Database) Write

func (d *Database) Write(json []byte) (int, error)

type EmailAlreadyExists

type EmailAlreadyExists struct{}

func (EmailAlreadyExists) Error

func (err EmailAlreadyExists) Error() string

type RestoreFailure

type RestoreFailure struct{}

func (RestoreFailure) Append

func (r RestoreFailure) Append(err error) error

func (RestoreFailure) Error

func (err RestoreFailure) Error() string

type User

type User struct {
	Uid      []byte
	Pswrd    []byte
	Salt     *sec.Salt
	Nick     string
	Cookies  CookieJar
	Feeds    []*rss.Feed
	FeedUrls []string
	// contains filtered or unexported fields
}

type UserAlreadyExists

type UserAlreadyExists struct{}

DATABASE ERRORS

func (UserAlreadyExists) Error

func (err UserAlreadyExists) Error() string

type UserDoesNotExist

type UserDoesNotExist struct{}

func (UserDoesNotExist) Error

func (err UserDoesNotExist) Error() string

Jump to

Keyboard shortcuts

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