model

package
v0.0.0-...-9ab988e Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2017 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewULID

func NewULID() string

NewULID generates a new ULID - a lexically sortable UUID

func UserExists

func UserExists(db *sql.DB, id string) (bool, error)

UserExists is a lightweight check to see if a User with a given ID is stored in the database

Types

type Device

type Device struct {
	PKey     ed25519.PublicKey
	FCMToken string
	UserID   string
}

Device is a data model of a users device (browser extension, mobile app)

func FindDevice

func FindDevice(db *sql.DB, pkey ed25519.PublicKey) (*Device, error)

FindDevice finds the Device from the database with the provided ID

func NewDevice

func NewDevice(pubkey ed25519.PublicKey, token, userID string) *Device

NewDevice returns a new instance of Device

func (*Device) Delete

func (d *Device) Delete(db *sql.DB) error

Delete the Device entry from the database

func (*Device) Save

func (d *Device) Save(db *sql.DB) error

Save the Device into the database

type Link struct {
	Body []byte

	Signature []byte
	SignedBy  []byte

	UserID string
	SeqNo  uint32
}

Link represents a single entry in a User's sigchain

func LastLink(db *sql.DB, userid string) (*Link, error)

LastLink returns the last Link in a User's sigchain

func NewLink(Body, Signature, SignedBy []byte, UserID string, SeqNo uint32) *Link

NewLink returns a new Link

func (*Link) Save

func (l *Link) Save(db *sql.DB) error

Save the Link into the database

type User

type User struct {
	ID string
}

User data model

func FindUser

func FindUser(db *sql.DB, id string) (*User, error)

FindUser finds the User from the database with the provided ID

func NewUser

func NewUser() *User

NewUser returns a new instance of User

func (*User) Delete

func (u *User) Delete(db *sql.DB) error

Delete the User entry from the database

func (*User) Save

func (u *User) Save(db *sql.DB) error

Save the User into the database

Jump to

Keyboard shortcuts

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