persistence

package
v0.0.0-...-c2f928c Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DIRECT login to the site
	DIRECT logintype = iota
	// FLOW or indirect login via login-flow
	FLOW
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Login

type Login struct {
	ID      int       `db:"id"`
	User    string    `db:"user"`
	Created time.Time `db:"created"`
	Type    logintype `db:"type"`
}

Login stores user logins

type Repository

type Repository interface {
	CreateAtomic() (per.Atomic, error)
	GetSitesByUser(user string) ([]UserSite, error)
	StoreSiteForUser(user string, sites []UserSite, a per.Atomic) (err error)
	StoreLogin(login Login, a per.Atomic) (err error)
	GetUsersForSite(site string) ([]string, error)
}

Repository defines the methods interacting with the store

func NewRepository

func NewRepository(c per.Connection) (Repository, error)

NewRepository creates a new instance using an existing connection

type UserSite

type UserSite struct {
	Name     string    `db:"name"`
	User     string    `db:"user"`
	URL      string    `db:"url"`
	PermList string    `db:"permission_list"`
	Created  time.Time `db:"created"`
}

UserSite defines sites and permissions for users

Jump to

Keyboard shortcuts

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