shared

package
v0.0.0-...-6eca257 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoEntryFound = errors.New("no entry found with this ID")

ErrNoEntryFound is returned when no entry to a id is found

Functions

This section is empty.

Types

type Entry

type Entry struct {
	OAuthProvider, OAuthID string
	RemoteAddr             string `json:",omitempty"`
	DeletionURL            string `json:",omitempty"`
	Password               []byte `json:",omitempty"`
	Public                 EntryPublicData
}

Entry is the data set which is stored in the DB as JSON

type EntryPublicData

type EntryPublicData struct {
	CreatedOn             time.Time
	LastVisit, Expiration *time.Time `json:",omitempty"`
	VisitCount            int
	URL                   string
}

EntryPublicData is the public part of an entry

type Storage

type Storage interface {
	GetEntryByID(string) (*Entry, error)
	GetVisitors(string) ([]Visitor, error)
	DeleteEntry(string) error
	IncreaseVisitCounter(string) error
	CreateEntry(Entry, string, string) error
	GetUserEntries(string) (map[string]Entry, error)
	RegisterVisitor(string, string, Visitor) error
	Close() error
}

Storage is an interface which will be implmented by each storage e.g. bolt, sqlite

type Visitor

type Visitor struct {
	IP, Referer, UserAgent                                 string
	Timestamp                                              time.Time
	UTMSource, UTMMedium, UTMCampaign, UTMContent, UTMTerm string `json:",omitempty"`
}

Visitor is the entry which is stored in the visitors bucket

Jump to

Keyboard shortcuts

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