store

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2019 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir added in v0.8.0

func Dir(useLocal bool, name string) http.FileSystem

Dir returns a http.Filesystem for the embedded assets on a given prefix dir. If useLocal is true, the filesystem's contents are instead used.

func FS added in v0.8.0

func FS(useLocal bool) http.FileSystem

FS returns a http.Filesystem for the embedded assets. If useLocal is true, the filesystem's contents are instead used.

func FSByte added in v0.8.0

func FSByte(useLocal bool, name string) ([]byte, error)

FSByte returns the named file from the embedded assets. If useLocal is true, the filesystem's contents are instead used.

func FSMustByte added in v0.8.0

func FSMustByte(useLocal bool, name string) []byte

FSMustByte is the same as FSByte, but panics if name is not present.

func FSMustString added in v0.8.0

func FSMustString(useLocal bool, name string) string

FSMustString is the string version of FSMustByte.

func FSString added in v0.8.0

func FSString(useLocal bool, name string) (string, error)

FSString is the string version of FSByte.

func MaxMigrateVersion added in v0.1.0

func MaxMigrateVersion() (uint, error)

MaxMigrateVersion returns the current DB migration file version

func NewMigrateDSN added in v0.1.0

func NewMigrateDSN(dsn string) (*migrate.Migrate, error)

NewMigrateDSN returns a new Migrate instance from a database URL

func NewMigrateInstance added in v0.1.0

func NewMigrateInstance(db *sql.DB) (*migrate.Migrate, error)

NewMigrateInstance returns a new Migrate instance from a postgres instance

func WithInstance added in v0.8.0

func WithInstance(fs http.FileSystem, config *Config) (source.Driver, error)

Types

type CommentOperator

type CommentOperator interface {
	// Save persists Comment in a store
	Save(context.Context, lookout.Event, *lookout.Comment, string) error
	// Posted checks if a comment was already posted for review
	Posted(context.Context, lookout.Event, *lookout.Comment) (bool, error)
}

CommentOperator manages persistence of Comments

type Config added in v0.8.0

type Config struct {
	Dir string
}

type DBCommentOperator

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

DBCommentOperator operates on comments database store

func NewDBCommentOperator

NewDBCommentOperator creates new DBCommentOperator using kallax as storage

func (*DBCommentOperator) Posted

Posted implements EventOperator interface

func (*DBCommentOperator) Save

func (o *DBCommentOperator) Save(ctx context.Context, e lookout.Event, c *lookout.Comment, analyzerName string) error

Save implements EventOperator interface

type DBEventOperator

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

DBEventOperator operates on event database store

func NewDBEventOperator

NewDBEventOperator creates new DBEventOperator using kallax as storage

func (*DBEventOperator) Save

Save implements EventOperator interface

func (*DBEventOperator) UpdateStatus

func (o *DBEventOperator) UpdateStatus(ctx context.Context, e lookout.Event, status models.EventStatus) error

UpdateStatus implements EventOperator interface

type DBOrganizationOperator added in v0.8.0

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

DBOrganizationOperator operates on an organization database store

func NewDBOrganizationOperator added in v0.8.0

func NewDBOrganizationOperator(store *models.OrganizationStore) *DBOrganizationOperator

NewDBOrganizationOperator creates new DBOrganizationOperator using kallax as storage

func (*DBOrganizationOperator) Config added in v0.8.0

func (o *DBOrganizationOperator) Config(ctx context.Context, provider string, orgID string) (string, error)

Config returns the stored config for the given (provider, orgID). If there are no records in the DB, it returns "" without error.

func (*DBOrganizationOperator) Save added in v0.8.0

func (o *DBOrganizationOperator) Save(ctx context.Context, provider string, orgID string, config string) error

Save persists the given config, updating the current one if it exists for the given (provider, orgID)

type EventOperator

type EventOperator interface {
	// Save persists Event in a store and returns Status if event was persisted already
	Save(context.Context, lookout.Event) (models.EventStatus, error)
	// UpdateStatus updates Status of event in a store
	UpdateStatus(context.Context, lookout.Event, models.EventStatus) error
}

EventOperator manages persistence of Events

type HttpFs added in v0.8.0

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

func (*HttpFs) Close added in v0.8.0

func (f *HttpFs) Close() error

func (*HttpFs) First added in v0.8.0

func (f *HttpFs) First() (version uint, err error)

func (*HttpFs) Next added in v0.8.0

func (f *HttpFs) Next(version uint) (nextVersion uint, err error)

func (*HttpFs) Open added in v0.8.0

func (f *HttpFs) Open(url string) (source.Driver, error)

func (*HttpFs) Prev added in v0.8.0

func (f *HttpFs) Prev(version uint) (prevVersion uint, err error)

func (*HttpFs) ReadDown added in v0.8.0

func (f *HttpFs) ReadDown(version uint) (r io.ReadCloser, identifier string, err error)

func (*HttpFs) ReadUp added in v0.8.0

func (f *HttpFs) ReadUp(version uint) (r io.ReadCloser, identifier string, err error)

type MemCommentOperator

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

MemCommentOperator satisfies CommentOperator interface but does nothing

func NewMemCommentOperator

func NewMemCommentOperator() *MemCommentOperator

NewMemCommentOperator creates new MemCommentOperator

func (*MemCommentOperator) Posted

Posted implements EventOperator interface

func (*MemCommentOperator) Save

func (o *MemCommentOperator) Save(ctx context.Context, e lookout.Event, c *lookout.Comment, analyzerName string) error

Save implements EventOperator interface

type MemEventOperator

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

MemEventOperator satisfies EventOperator interface keeps events in memory

func NewMemEventOperator

func NewMemEventOperator() *MemEventOperator

NewMemEventOperator creates new MemEventOperator

func (*MemEventOperator) Save

Save implements EventOperator interface

func (*MemEventOperator) UpdateStatus

func (o *MemEventOperator) UpdateStatus(ctx context.Context, e lookout.Event, s models.EventStatus) error

UpdateStatus implements EventOperator interface

type NoopCommentOperator

type NoopCommentOperator struct{}

NoopCommentOperator satisfies CommentOperator interface but does nothing

func (*NoopCommentOperator) Posted

Posted implements EventOperator interface and always returns false

func (*NoopCommentOperator) Save

Save implements EventOperator interface and does nothing

type NoopEventOperator

type NoopEventOperator struct{}

NoopEventOperator satisfies EventOperator interface but does nothing

func (*NoopEventOperator) Save

Save implements EventOperator interface and always returns New status

func (*NoopEventOperator) UpdateStatus

UpdateStatus implements EventOperator interface and does nothing

type NoopOrganizationOperator added in v0.8.0

type NoopOrganizationOperator struct{}

NoopOrganizationOperator satisfies OrganizationOperator interface but does nothing

func (*NoopOrganizationOperator) Config added in v0.8.0

func (o *NoopOrganizationOperator) Config(ctx context.Context, provider string, orgID string) (string, error)

Config returns the stored config for the given (provider, orgID). If there are no records in the DB, it returns "" without error.

func (*NoopOrganizationOperator) Save added in v0.8.0

func (o *NoopOrganizationOperator) Save(ctx context.Context, provider string, orgID string, config string) error

Save persists the given config, updating the current one if it exists for the given (provider, orgID)

type OrganizationOperator added in v0.8.0

type OrganizationOperator interface {
	// Save persists the given config, updating the current one if it exists
	// for the given (provider, orgID)
	Save(ctx context.Context, provider string, orgID string, config string) error
	// Config returns the stored config for the given (provider, orgID). If there
	// are no records in the DB, it returns "" without error.
	Config(ctx context.Context, provider string, orgID string) (string, error)
}

OrganizationOperator manages persistence of default config for organizations

Directories

Path Synopsis
Code generated by https://github.com/src-d/go-kallax.
Code generated by https://github.com/src-d/go-kallax.

Jump to

Keyboard shortcuts

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