Documentation ¶
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func MaxMigrateVersion() (uint, error)
- func MustAsset(name string) []byte
- func NewMigrateDSN(dsn string) (*migrate.Migrate, error)
- func NewMigrateInstance(db *sql.DB) (*migrate.Migrate, error)
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type CommentOperator
- type DBCommentOperator
- type DBEventOperator
- type EventOperator
- type MemCommentOperator
- type MemEventOperator
- type NoopCommentOperator
- type NoopEventOperator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func MaxMigrateVersion ¶ added in v0.1.0
MaxMigrateVersion returns the current DB migration file version
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func NewMigrateDSN ¶ added in v0.1.0
NewMigrateDSN returns a new Migrate instance from a database URL
func NewMigrateInstance ¶ added in v0.1.0
NewMigrateInstance returns a new Migrate instance from a postgres instance
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
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 DBCommentOperator ¶
type DBCommentOperator struct {
// contains filtered or unexported fields
}
DBCommentOperator operates on comments database store
func NewDBCommentOperator ¶
func NewDBCommentOperator( c *models.CommentStore, r *models.ReviewEventStore, rt *models.ReviewTargetStore, ) *DBCommentOperator
NewDBCommentOperator creates new DBCommentOperator using kallax as storage
type DBEventOperator ¶
type DBEventOperator struct {
// contains filtered or unexported fields
}
DBEventOperator operates on event database store
func NewDBEventOperator ¶
func NewDBEventOperator( r *models.ReviewEventStore, rt *models.ReviewTargetStore, p *models.PushEventStore, ) *DBEventOperator
NewDBEventOperator creates new DBEventOperator using kallax as storage
func (*DBEventOperator) Save ¶
func (o *DBEventOperator) Save(ctx context.Context, e lookout.Event) (models.EventStatus, error)
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 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 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
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 ¶
func (o *MemEventOperator) Save(ctx context.Context, e lookout.Event) (models.EventStatus, error)
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
type NoopEventOperator ¶
type NoopEventOperator struct{}
NoopEventOperator satisfies EventOperator interface but does nothing
func (*NoopEventOperator) Save ¶
func (o *NoopEventOperator) Save(context.Context, lookout.Event) (models.EventStatus, error)
Save implements EventOperator interface and always returns New status
func (*NoopEventOperator) UpdateStatus ¶
func (o *NoopEventOperator) UpdateStatus(context.Context, lookout.Event, models.EventStatus) error
UpdateStatus implements EventOperator interface and does nothing