proj

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoProject   = errors.New("proj: no open project")
	ErrNoSettings  = errors.New("proj: settings not found")
	ErrInvalidName = errors.New("proj: invalid name, must be alphanumeric or whitespace chars")
)

Functions

This section is empty.

Types

type OnProjectCloseFn

type OnProjectCloseFn func(name string) error

type OnProjectOpenFn

type OnProjectOpenFn func(name string) error

type Project

type Project struct {
	Name     string
	IsActive bool
}

type Repository

type Repository interface {
	UpsertSettings(ctx context.Context, module string, settings interface{}) error
	FindSettingsByModule(ctx context.Context, module string, settings interface{}) error
	OpenProject(name string) error
	DeleteProject(name string) error
	Projects() ([]Project, error)
	Close() error
}

type Service

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

Service is used for managing projects.

func NewService

func NewService(repo Repository) (*Service, error)

NewService returns a new Service.

func (*Service) ActiveProject

func (svc *Service) ActiveProject() (Project, error)

func (*Service) Close

func (svc *Service) Close() error

Close closes the currently open project database (if there is one).

func (*Service) Delete

func (svc *Service) Delete(name string) error

Delete removes a project database file from disk (if there is one).

func (*Service) OnProjectClose

func (svc *Service) OnProjectClose(fn OnProjectCloseFn)

func (*Service) OnProjectOpen

func (svc *Service) OnProjectOpen(fn OnProjectOpenFn)

func (*Service) Open

func (svc *Service) Open(ctx context.Context, name string) (Project, error)

Open opens a database identified with `name`. If a database with this identifier doesn't exist yet, it will be automatically created.

func (*Service) Projects

func (svc *Service) Projects() ([]Project, error)

Jump to

Keyboard shortcuts

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