storage

package
v0.0.0-...-289f4dd Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DashboardStorage

type DashboardStorage interface {
	Create(owner, invited uint) (models.Dashboard, error)
	List(userid uint) ([]models.Dashboard, error)
	GetById(id string) (models.Dashboard, error)
	UpdateStatus(id string, status models.Status) (models.Dashboard, error)
	Delete(id string) error
}

func NewDashboardStorage

func NewDashboardStorage(db *gorm.DB) DashboardStorage

type OAuthStorage

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

func New

func New(db *sql.DB) *OAuthStorage

New returns a new postgres storage instance.

func (OAuthStorage) Clone

func (s OAuthStorage) Clone() osin.Storage

Clone the storage if needed. For example, using mgo, you can clone the session with session.Clone to avoid concurrent access problems. This is to avoid cloning the connection at each method access. Can return itself if not a problem.

func (OAuthStorage) Close

func (s OAuthStorage) Close()

Close the resources the Storage potentially holds (using Clone for example)

func (OAuthStorage) CreateClient

func (s OAuthStorage) CreateClient(c osin.Client) error

CreateClient stores the client in the database and returns an error, if something went wrong.

func (OAuthStorage) GetClient

func (s OAuthStorage) GetClient(id string) (osin.Client, error)

GetClient loads the client by id

func (OAuthStorage) LoadAccess

func (s OAuthStorage) LoadAccess(code string) (*osin.AccessData, error)

LoadAccess retrieves access data by keys. Client information MUST be loaded together. AuthorizeData and AccessData DON'T NEED to be loaded if not easily available. Optionally can return error if expired.

func (OAuthStorage) LoadAuthorize

func (s OAuthStorage) LoadAuthorize(code string) (*osin.AuthorizeData, error)

LoadAuthorize looks up AuthorizeData by a code. Client information MUST be loaded together. Optionally can return error if expired.

func (OAuthStorage) LoadRefresh

func (s OAuthStorage) LoadRefresh(code string) (*osin.AccessData, error)

LoadRefresh retrieves refresh AccessData. Client information MUST be loaded together. AuthorizeData and AccessData DON'T NEED to be loaded if not easily available. Optionally can return error if expired.

func (OAuthStorage) RemoveAccess

func (s OAuthStorage) RemoveAccess(code string) (err error)

RemoveAccess revokes or deletes an AccessData.

func (OAuthStorage) RemoveAuthorize

func (s OAuthStorage) RemoveAuthorize(code string) (err error)

RemoveAuthorize revokes or deletes the authorization code.

func (OAuthStorage) RemoveClient

func (s OAuthStorage) RemoveClient(id string) (err error)

RemoveClient removes a client (identified by id) from the database. Returns an error if something went wrong.

func (OAuthStorage) RemoveRefresh

func (s OAuthStorage) RemoveRefresh(code string) error

RemoveRefresh revokes or deletes refresh AccessData.

func (OAuthStorage) SaveAccess

func (s OAuthStorage) SaveAccess(data *osin.AccessData) (err error)

SaveAccess writes AccessData. If RefreshToken is not blank, it must save in a way that can be loaded using LoadRefresh.

func (OAuthStorage) SaveAuthorize

func (s OAuthStorage) SaveAuthorize(data *osin.AuthorizeData) (err error)

SaveAuthorize saves authorize data.

func (OAuthStorage) UpdateClient

func (s OAuthStorage) UpdateClient(c osin.Client) error

UpdateClient updates the client (identified by its id) and replaces the values with the values of client.

type ProjectStorage

type ProjectStorage interface {
	Create(owner, invited uint) (models.Project, error)
	List(userid uint) ([]models.Project, error)
	GetById(id string) (models.Project, error)
	UpdateStatus(id string, status models.Status) (models.Project, error)
	Delete(id string) error
}

func NewProjectStorage

func NewProjectStorage(db *gorm.DB) ProjectStorage

type UserStorage

type UserStorage interface {
	CreateUser(email, loginType, profilePic string) (models.User, error)
	GetUser(email string) (models.User, error)
}

func NewUserStorage

func NewUserStorage(db *gorm.DB) UserStorage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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