proj

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProjectNotFound = errors.New("proj: project not found")
	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 Config added in v0.4.0

type Config struct {
	Repository    Repository
	ReqLogService reqlog.Service
	SenderService sender.Service
	Scope         *scope.Scope
}

type OnProjectCloseFn

type OnProjectCloseFn func(projectID ulid.ULID) error

type OnProjectOpenFn

type OnProjectOpenFn func(projectID ulid.ULID) error

type Project

type Project struct {
	ID       ulid.ULID
	Name     string
	Settings Settings
	// contains filtered or unexported fields
}

type Repository

type Repository interface {
	FindProjectByID(ctx context.Context, id ulid.ULID) (Project, error)
	UpsertProject(ctx context.Context, project Project) error
	DeleteProject(ctx context.Context, id ulid.ULID) error
	Projects(ctx context.Context) ([]Project, error)
	Close() error
}

type Service

type Service interface {
	CreateProject(ctx context.Context, name string) (Project, error)
	OpenProject(ctx context.Context, projectID ulid.ULID) (Project, error)
	CloseProject() error
	DeleteProject(ctx context.Context, projectID ulid.ULID) error
	ActiveProject(ctx context.Context) (Project, error)
	IsProjectActive(projectID ulid.ULID) bool
	Projects(ctx context.Context) ([]Project, error)
	Scope() *scope.Scope
	SetScopeRules(ctx context.Context, rules []scope.Rule) error
	SetRequestLogFindFilter(ctx context.Context, filter reqlog.FindRequestsFilter) error
	SetSenderRequestFindFilter(ctx context.Context, filter sender.FindRequestsFilter) error
	OnProjectOpen(fn OnProjectOpenFn)
	OnProjectClose(fn OnProjectCloseFn)
}

Service is used for managing projects.

func NewService

func NewService(cfg Config) (Service, error)

NewService returns a new Service.

type Settings added in v0.4.0

type Settings struct {
	ReqLogBypassOutOfScope bool
	ReqLogOnlyFindInScope  bool
	ReqLogSearchExpr       search.Expression

	SenderOnlyFindInScope bool
	SenderSearchExpr      search.Expression

	ScopeRules []scope.Rule
}

Jump to

Keyboard shortcuts

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