keys

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExists      = errors.New("can't check existence without id or name")
	ErrNoAccountID = errors.New("missing account identifer for save")
	ErrMissingID   = errors.New("missing identifer for save")
)

Functions

This section is empty.

Types

type Key

type Key struct {
	ID          string
	Name        string
	Fingerprint string
	Material    string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	AccountID   string
	Archived    bool
	// contains filtered or unexported fields
}

Key represents the data associated with an tsg_keys row.

func New

func New(store *Store) *Key

New constructs a new Key with the Store for backend persistence.

func (*Key) Exists

func (k *Key) Exists(ctx context.Context) (bool, error)

Exists returns a boolean and error. True if the row exists, false if it doesn't, error if there was an error executing the query.

func (*Key) Insert

func (k *Key) Insert(ctx context.Context) error

Insert inserts a new key into the tsg_keys table.

func (*Key) Save

func (k *Key) Save(ctx context.Context) error

Save saves an keys.Key object and it's field values.

type Store

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

func NewStore

func NewStore(pool *pgx.ConnPool) *Store

NewStore returns a new store object.

func (*Store) FindByID

func (s *Store) FindByID(ctx context.Context, keyID string) (*Key, error)

FindByID finds an account by a specific ID.

func (*Store) FindByName

func (s *Store) FindByName(ctx context.Context, keyName string, accountID string) (*Key, error)

FindByName finds an account by a specific account_name.

Jump to

Keyboard shortcuts

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