db

package
v0.0.0-...-8bc3bcf Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	Open() error

	InsertUser(email, password string) error
	SelectUser(email string) (UserRecord, error)

	CreateSession(userId, ipAddress string) (*SessionRecord, error)
	GetSession(id string) (*SessionRecord, error)
}

func NewSqliteStore

func NewSqliteStore(filename string) Database

type SessionRecord

type SessionRecord struct {
	Id           string    `db:"id"`
	UserId       string    `db:"user_id"`
	IpAddress    string    `db:"ip_address"`
	Active       bool      `db:"active"`
	LastActivity time.Time `db:"last_activity"`
}

type SqliteStore

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

func (*SqliteStore) ChangeUserPassword

func (s *SqliteStore) ChangeUserPassword(email, password string) error

func (*SqliteStore) CreateSession

func (s *SqliteStore) CreateSession(userId, ipAddress string) (*SessionRecord, error)

func (*SqliteStore) GetSession

func (s *SqliteStore) GetSession(id string) (*SessionRecord, error)

func (*SqliteStore) InsertUser

func (s *SqliteStore) InsertUser(email, password string) error

func (*SqliteStore) Open

func (s *SqliteStore) Open() error

func (*SqliteStore) SelectUser

func (s *SqliteStore) SelectUser(email string) (UserRecord, error)

type UserRecord

type UserRecord struct {
	Id       string `db:"id"`
	Email    string `db:"email"`
	Password string `db:"password"`
}

Jump to

Keyboard shortcuts

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