Documentation

Overview

Package database is a database interface to authorized apps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizedAppDB

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

AuthorizedAppDB is a handle to database operations for authorized apps (referred to as healthAuthorityID in v1 publish API).

func New

func New(db *database.DB) *AuthorizedAppDB

New creates a new authorizedAppDB that wraps a raw database handle.

func (*AuthorizedAppDB) DeleteAuthorizedApp

func (aa *AuthorizedAppDB) DeleteAuthorizedApp(ctx context.Context, name string) error

DeleteAuthorizedApp removes an authorized app from the database.

func (*AuthorizedAppDB) GetAuthorizedApp

func (aa *AuthorizedAppDB) GetAuthorizedApp(ctx context.Context, name string) (*model.AuthorizedApp, error)

GetAuthorizedApp loads a single AuthorizedApp for the given name. If no row exists, this returns nil.

func (*AuthorizedAppDB) InsertAuthorizedApp

func (aa *AuthorizedAppDB) InsertAuthorizedApp(ctx context.Context, m *model.AuthorizedApp) error

InsertAuthorizedApp inserts an authorized app into the database, caling the validate method first and returning any errors.

func (*AuthorizedAppDB) ListAuthorizedApps

func (aa *AuthorizedAppDB) ListAuthorizedApps(ctx context.Context) ([]*model.AuthorizedApp, error)

ListAuthorizedApps reads all authorized app, returned in alphabetical order by healthAuthorityID (app_package_name).

func (*AuthorizedAppDB) UpdateAuthorizedApp

func (aa *AuthorizedAppDB) UpdateAuthorizedApp(ctx context.Context, priorKey string, m *model.AuthorizedApp) error

UpdateAuthorizedApp updates the properties of an authorized app, including possibly renaming it.