Documentation
¶
Overview ¶
Package postgres provides gophkeeper implementation with postgresql database storage.
Index ¶
- func WithBlobsDir(dir string) option
- func WithPasswordEncoding(encoding *base64.Encoding) option
- type DSNSource
- type DatabaseSource
- type Gophkeeper
- func (r *Gophkeeper) Authenticate(ctx context.Context, credential gophkeeper.Credential) (gophkeeper.Token, error)
- func (r *Gophkeeper) Identity(ctx context.Context, token gophkeeper.Token) (gophkeeper.Identity, error)
- func (r *Gophkeeper) Register(ctx context.Context, credential gophkeeper.Credential) error
- func (r *Gophkeeper) Run(ctx context.Context) error
- type Identity
- func (i *Identity) Delete(ctx context.Context, rid gophkeeper.ResourceID) error
- func (i *Identity) List(ctx context.Context) ([]gophkeeper.Resource, error)
- func (i *Identity) RestoreBlob(ctx context.Context, rid gophkeeper.ResourceID, password string) (gophkeeper.Blob, error)
- func (i *Identity) RestorePiece(ctx context.Context, rid gophkeeper.ResourceID, password string) (gophkeeper.Piece, error)
- func (i *Identity) StoreBlob(ctx context.Context, blob gophkeeper.Blob, password string) (gophkeeper.ResourceID, error)
- func (i *Identity) StorePiece(ctx context.Context, piece gophkeeper.Piece, password string) (gophkeeper.ResourceID, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithBlobsDir ¶
func WithBlobsDir(dir string) option
WithBlobsDir sets blobs dir to the gophkeeper.
func WithPasswordEncoding ¶
WithPasswordEnoding sets password encoding to the gophkeeper.
Types ¶
type DatabaseSource ¶
DatabaseSource is a source of pgx connections.
type Gophkeeper ¶
type Gophkeeper struct {
// contains filtered or unexported fields
}
Gophkeeper is a postgresql identity repository.
func New ¶
func New(source DatabaseSource, tokenSource server.UsernameBasedTokenSource, options ...option) *Gophkeeper
New craetes a new postgres Gophkeeper and returns it.
func (*Gophkeeper) Authenticate ¶
func (r *Gophkeeper) Authenticate(ctx context.Context, credential gophkeeper.Credential) (gophkeeper.Token, error)
Authenticate implements Repository.
func (*Gophkeeper) Identity ¶
func (r *Gophkeeper) Identity(ctx context.Context, token gophkeeper.Token) (gophkeeper.Identity, error)
Identity implements Repository.
func (*Gophkeeper) Register ¶
func (r *Gophkeeper) Register(ctx context.Context, credential gophkeeper.Credential) error
Register implements Repository.
type Identity ¶
type Identity struct { Connection *pgx.Conn PasswordEncoding *base64.Encoding BlobsDir string Username string }
Identity is a postgres identity.
func (*Identity) Delete ¶
func (i *Identity) Delete(ctx context.Context, rid gophkeeper.ResourceID) error
Delete implements Identity.
func (*Identity) RestoreBlob ¶
func (i *Identity) RestoreBlob(ctx context.Context, rid gophkeeper.ResourceID, password string) (gophkeeper.Blob, error)
RestoreBlob implements Identity.
func (*Identity) RestorePiece ¶
func (i *Identity) RestorePiece(ctx context.Context, rid gophkeeper.ResourceID, password string) (gophkeeper.Piece, error)
RestorePiece implements Identity.
func (*Identity) StoreBlob ¶
func (i *Identity) StoreBlob(ctx context.Context, blob gophkeeper.Blob, password string) (gophkeeper.ResourceID, error)
StoreBlob implements Identity.
func (*Identity) StorePiece ¶
func (i *Identity) StorePiece(ctx context.Context, piece gophkeeper.Piece, password string) (gophkeeper.ResourceID, error)
StorePiece implements Identity.
Click to show internal directories.
Click to hide internal directories.