Documentation
¶
Index ¶
- Constants
- type Engine
- func (e *Engine) CountHooks(ctx context.Context) (int64, error)
- func (e *Engine) CountHooksForRepo(ctx context.Context, r *api.Repo) (int64, error)
- func (e *Engine) CreateHook(ctx context.Context, h *api.Hook) (*api.Hook, error)
- func (e *Engine) CreateHookIndexes(ctx context.Context) error
- func (e *Engine) CreateHookTable(ctx context.Context, driver string) error
- func (e *Engine) DeleteHook(ctx context.Context, h *api.Hook) error
- func (e *Engine) GetHook(ctx context.Context, id int64) (*api.Hook, error)
- func (e *Engine) GetHookByWebhookID(ctx context.Context, webhookID int64) (*api.Hook, error)
- func (e *Engine) GetHookForRepo(ctx context.Context, r *api.Repo, number int64) (*api.Hook, error)
- func (e *Engine) LastHookForRepo(ctx context.Context, r *api.Repo) (*api.Hook, error)
- func (e *Engine) ListHooks(ctx context.Context) ([]*api.Hook, error)
- func (e *Engine) ListHooksForRepo(ctx context.Context, r *api.Repo, page, perPage int) ([]*api.Hook, error)
- func (e *Engine) UpdateHook(ctx context.Context, h *api.Hook) (*api.Hook, error)
- type EngineOpt
- type HookInterface
Constants ¶
const ( // CreatePostgresTable represents a query to create the Postgres hooks table. CreatePostgresTable = `` /* 436-byte string literal not displayed */ // CreateSqliteTable represents a query to create the Sqlite hooks table. CreateSqliteTable = `` /* 388-byte string literal not displayed */ )
const ( // CreateRepoIDIndex represents a query to create an // index on the hooks table for the repo_id column. CreateRepoIDIndex = ` CREATE INDEX IF NOT EXISTS hooks_repo_id ON hooks (repo_id); ` )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶ added in v0.27.0
type Engine struct {
// contains filtered or unexported fields
}
Engine represents the hook functionality that implements the HookInterface interface.
func (*Engine) CountHooks ¶ added in v0.27.0
CountHooks gets the count of all hooks from the database.
func (*Engine) CountHooksForRepo ¶ added in v0.27.0
CountHooksForRepo gets the count of hooks by repo ID from the database.
func (*Engine) CreateHook ¶ added in v0.27.0
CreateHook creates a new hook in the database.
func (*Engine) CreateHookIndexes ¶ added in v0.27.0
CreateHookIndexes creates the indexes for the hooks table in the database.
func (*Engine) CreateHookTable ¶ added in v0.27.0
CreateHookTable creates the hooks table in the database.
func (*Engine) DeleteHook ¶ added in v0.27.0
DeleteHook deletes an existing hook from the database.
func (*Engine) GetHookByWebhookID ¶ added in v0.27.0
GetHookByWebhookID gets a single hook with a matching webhook id in the database.
func (*Engine) GetHookForRepo ¶ added in v0.27.0
GetHookForRepo gets a hook by repo ID and number from the database.
func (*Engine) LastHookForRepo ¶ added in v0.27.0
LastHookForRepo gets the last hook by repo ID from the database.
type EngineOpt ¶
EngineOpt represents a configuration option to initialize the database engine for Hooks.
func WithClient ¶
WithClient sets the gorm.io/gorm client in the database engine for Hooks.
func WithContext ¶ added in v0.21.0
WithContext sets the context in the database engine for Repos.
func WithEncryptionKey ¶ added in v0.25.0
WithEncryptionKey sets the encryption key in the database engine for Builds.
func WithLogger ¶
WithLogger sets the github.com/sirupsen/logrus logger in the database engine for Hooks.
func WithSkipCreation ¶
WithSkipCreation sets the skip creation logic in the database engine for Hooks.
type HookInterface ¶ added in v0.20.0
type HookInterface interface {
// CreateHookIndexes defines a function that creates the indexes for the hooks table.
CreateHookIndexes(context.Context) error
// CreateHookTable defines a function that creates the hooks table.
CreateHookTable(context.Context, string) error
// CountHooks defines a function that gets the count of all hooks.
CountHooks(context.Context) (int64, error)
// CountHooksForRepo defines a function that gets the count of hooks by repo ID.
CountHooksForRepo(context.Context, *api.Repo) (int64, error)
// CreateHook defines a function that creates a new hook.
CreateHook(context.Context, *api.Hook) (*api.Hook, error)
// DeleteHook defines a function that deletes an existing hook.
DeleteHook(context.Context, *api.Hook) error
// GetHook defines a function that gets a hook by ID.
GetHook(context.Context, int64) (*api.Hook, error)
// GetHookByWebhookID defines a function that gets any hook with a matching webhook_id.
GetHookByWebhookID(context.Context, int64) (*api.Hook, error)
// GetHookForRepo defines a function that gets a hook by repo ID and number.
GetHookForRepo(context.Context, *api.Repo, int64) (*api.Hook, error)
// LastHookForRepo defines a function that gets the last hook by repo ID.
LastHookForRepo(context.Context, *api.Repo) (*api.Hook, error)
// ListHooks defines a function that gets a list of all hooks.
ListHooks(context.Context) ([]*api.Hook, error)
// ListHooksForRepo defines a function that gets a list of hooks by repo ID.
ListHooksForRepo(context.Context, *api.Repo, int, int) ([]*api.Hook, error)
// UpdateHook defines a function that updates an existing hook.
UpdateHook(context.Context, *api.Hook) (*api.Hook, error)
}