Documentation ¶
Index ¶
- Constants
- func Validate(iv *InputScript) error
- type DbProvider
- type InputScript
- type Manager
- func (m *Manager) Close() error
- func (m *Manager) Create(ctx context.Context, valueToStore *InputScript, username string) (*Script, error)
- func (m *Manager) Delete(ctx context.Context, id string) error
- func (m *Manager) GetOne(ctx context.Context, re *http.Request, id string) (*Script, bool, error)
- func (m *Manager) List(ctx context.Context, re *http.Request) ([]Script, int, error)
- func (m *Manager) Update(ctx context.Context, existingID string, valueToStore *InputScript, ...) (*Script, error)
- type Script
- type SqliteProvider
- func (p *SqliteProvider) Close() error
- func (p *SqliteProvider) Delete(ctx context.Context, id string) error
- func (p *SqliteProvider) GetByID(ctx context.Context, id string, ro *query.RetrieveOptions) (val *Script, found bool, err error)
- func (p *SqliteProvider) List(ctx context.Context, lo *query.ListOptions) ([]Script, error)
- func (p *SqliteProvider) Save(ctx context.Context, s *Script, nowDate time.Time) (string, error)
Constants ¶
View Source
const DefaultTimeoutSec = 60
Variables ¶
This section is empty.
Functions ¶
func Validate ¶
func Validate(iv *InputScript) error
Types ¶
type DbProvider ¶
type DbProvider interface { GetByID(ctx context.Context, id string, ro *query.RetrieveOptions) (val *Script, found bool, err error) List(ctx context.Context, lo *query.ListOptions) ([]Script, error) Save(ctx context.Context, s *Script, nowDate time.Time) (string, error) Delete(ctx context.Context, id string) error io.Closer }
type InputScript ¶
type InputScript struct { Name string `json:"name" db:"name"` Interpreter string `json:"interpreter" db:"interpreter"` IsSudo bool `json:"is_sudo" db:"is_sudo"` Cwd string `json:"cwd" db:"cwd"` Script string `json:"script" db:"script"` Tags []string `json:"tags" db:"tags"` TimoutSec int `json:"timeout_sec" db:"timeout_sec"` }
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(db DbProvider, logger *logger.Logger) *Manager
type Script ¶
type Script struct { ID string `json:"id,omitempty" db:"id"` Name string `json:"name,omitempty" db:"name"` CreatedBy string `json:"created_by,omitempty" db:"created_by"` CreatedAt *time.Time `json:"created_at,omitempty" db:"created_at"` UpdatedBy string `json:"updated_by,omitempty" db:"updated_by"` UpdatedAt *time.Time `json:"updated_at,omitempty" db:"updated_at"` Interpreter *string `json:"interpreter,omitempty" db:"interpreter"` IsSudo *bool `json:"is_sudo,omitempty" db:"is_sudo"` Cwd *string `json:"cwd,omitempty" db:"cwd"` Script string `json:"script,omitempty" db:"script"` Tags *types.StringSlice `json:"tags,omitempty" db:"tags"` TimoutSec *int `json:"timeout_sec,omitempty" db:"timeout_sec"` }
To support sparse fieldsets, the fields that can have zero value, use pointers so they're omitted only when they're nil not when they're zero value
type SqliteProvider ¶
type SqliteProvider struct {
// contains filtered or unexported fields
}
func NewSqliteProvider ¶
func NewSqliteProvider(db *sqlx.DB) *SqliteProvider
func (*SqliteProvider) Close ¶
func (p *SqliteProvider) Close() error
func (*SqliteProvider) Delete ¶
func (p *SqliteProvider) Delete(ctx context.Context, id string) error
func (*SqliteProvider) GetByID ¶
func (p *SqliteProvider) GetByID(ctx context.Context, id string, ro *query.RetrieveOptions) (val *Script, found bool, err error)
func (*SqliteProvider) List ¶
func (p *SqliteProvider) List(ctx context.Context, lo *query.ListOptions) ([]Script, error)
Click to show internal directories.
Click to hide internal directories.