Documentation ¶
Overview ¶
Package models contains generated code for schema 'loop.db'.
Index ¶
- Variables
- func Errorf(s string, v ...interface{})
- func Logf(s string, v ...interface{})
- func SetErrorLogger(logger interface{})
- func SetLogger(logger interface{})
- type Conn
- type DB
- type ErrInsertFailed
- type ErrInvalidTime
- type ErrUpdateFailed
- type ErrUpsertFailed
- type Error
- type FindRunResult
- type IndexRunsResult
- type Meta
- type Run
- func CreateThunkRun(ctx context.Context, db DB, user *github.User, thunk bass.Thunk, ...) (*Run, error)
- func RunByID(ctx context.Context, db DB, id string) (*Run, error)
- func RunsByThunkDigest(ctx context.Context, db DB, thunkDigest string) ([]*Run, error)
- func RunsByUserID(ctx context.Context, db DB, userID string) ([]*Run, error)
- func (r *Run) Delete(ctx context.Context, db DB) error
- func (r *Run) Deleted() bool
- func (r *Run) Exists() bool
- func (r *Run) Insert(ctx context.Context, db DB) error
- func (r *Run) Save(ctx context.Context, db DB) error
- func (r *Run) Thunk(ctx context.Context, db DB) (*Thunk, error)
- func (r *Run) Update(ctx context.Context, db DB) error
- func (r *Run) Upsert(ctx context.Context, db DB) error
- func (r *Run) User(ctx context.Context, db DB) (*User, error)
- type Runtime
- func (r *Runtime) Delete(ctx context.Context, db DB) error
- func (r *Runtime) Deleted() bool
- func (r *Runtime) Exists() bool
- func (r *Runtime) Insert(ctx context.Context, db DB) error
- func (r *Runtime) Save(ctx context.Context, db DB) error
- func (r *Runtime) Update(ctx context.Context, db DB) error
- func (r *Runtime) Upsert(ctx context.Context, db DB) error
- func (r *Runtime) User(ctx context.Context, db DB) (*User, error)
- type SchemaMigration
- type Service
- func ServiceByRuntimeNameService(ctx context.Context, db DB, runtimeName, service string) (*Service, error)
- func ServiceByUserIDRuntimeNameService(ctx context.Context, db DB, userID, runtimeName, service string) (*Service, error)
- func ServicesByUserIDRuntimeName(ctx context.Context, db DB, userID, runtimeName string) ([]*Service, error)
- func (s *Service) Delete(ctx context.Context, db DB) error
- func (s *Service) Deleted() bool
- func (s *Service) Exists() bool
- func (s *Service) Insert(ctx context.Context, db DB) error
- func (s *Service) Save(ctx context.Context, db DB) error
- func (s *Service) Update(ctx context.Context, db DB) error
- func (s *Service) Upsert(ctx context.Context, db DB) error
- func (s *Service) User(ctx context.Context, db DB) (*User, error)
- type Thunk
- func (t *Thunk) Delete(ctx context.Context, db DB) error
- func (t *Thunk) Deleted() bool
- func (t *Thunk) Exists() bool
- func (t *Thunk) Insert(ctx context.Context, db DB) error
- func (t *Thunk) Save(ctx context.Context, db DB) error
- func (t *Thunk) Update(ctx context.Context, db DB) error
- func (t *Thunk) Upsert(ctx context.Context, db DB) error
- type Time
- type User
- func (u *User) Delete(ctx context.Context, db DB) error
- func (u *User) Deleted() bool
- func (u *User) Exists() bool
- func (u *User) Insert(ctx context.Context, db DB) error
- func (u *User) Save(ctx context.Context, db DB) error
- func (u *User) Update(ctx context.Context, db DB) error
- func (u *User) Upsert(ctx context.Context, db DB) error
- type Vertex
- func (v *Vertex) Delete(ctx context.Context, db DB) error
- func (v *Vertex) Deleted() bool
- func (v *Vertex) Exists() bool
- func (v *Vertex) Insert(ctx context.Context, db DB) error
- func (v *Vertex) Run(ctx context.Context, db DB) (*Run, error)
- func (v *Vertex) Save(ctx context.Context, db DB) error
- func (v *Vertex) Update(ctx context.Context, db DB) error
- func (v *Vertex) Upsert(ctx context.Context, db DB) error
- type VertexEdge
- func VertexEdgeBySourceDigestTargetDigest(ctx context.Context, db DB, sourceDigest, targetDigest string) (*VertexEdge, error)
- func VertexEdgesBySourceDigest(ctx context.Context, db DB, sourceDigest string) ([]*VertexEdge, error)
- func VertexEdgesByTargetDigest(ctx context.Context, db DB, targetDigest string) ([]*VertexEdge, error)
Constants ¶
This section is empty.
Variables ¶
var TimestampFormats = []string{
"2006-01-02 15:04:05.999999999-07:00",
"2006-01-02T15:04:05.999999999-07:00",
"2006-01-02 15:04:05.999999999",
"2006-01-02T15:04:05.999999999",
"2006-01-02 15:04:05",
"2006-01-02T15:04:05",
"2006-01-02 15:04",
"2006-01-02T15:04",
"2006-01-02",
}
TimestampFormats are the timestamp formats used by SQLite3 database drivers to store a time.Time in SQLite3.
The first format in the slice will be used when saving time values into the database. When parsing a string from a timestamp or datetime column, the formats are tried in order.
Functions ¶
func Errorf ¶
func Errorf(s string, v ...interface{})
Errorf logs an error message using the package error logger.
func SetErrorLogger ¶
func SetErrorLogger(logger interface{})
SetErrorLogger sets the package error logger. Valid logger types:
io.Writer func(string, ...interface{}) (int, error) // fmt.Printf func(string, ...interface{}) // log.Printf
Types ¶
type DB ¶
type DB interface { ExecContext(context.Context, string, ...interface{}) (sql.Result, error) QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) QueryRowContext(context.Context, string, ...interface{}) *sql.Row }
DB is the common interface for database operations that can be used with types from schema 'loop.db'.
This works with both database/sql.DB and database/sql.Tx.
type ErrInsertFailed ¶
type ErrInsertFailed struct {
Err error
}
ErrInsertFailed is the insert failed error.
func (*ErrInsertFailed) Error ¶
func (err *ErrInsertFailed) Error() string
Error satisfies the error interface.
func (*ErrInsertFailed) Unwrap ¶
func (err *ErrInsertFailed) Unwrap() error
Unwrap satisfies the unwrap interface.
type ErrInvalidTime ¶
type ErrInvalidTime string
ErrInvalidTime is the invalid Time error.
func (ErrInvalidTime) Error ¶
func (err ErrInvalidTime) Error() string
Error satisfies the error interface.
type ErrUpdateFailed ¶
type ErrUpdateFailed struct {
Err error
}
ErrUpdateFailed is the update failed error.
func (*ErrUpdateFailed) Error ¶
func (err *ErrUpdateFailed) Error() string
Error satisfies the error interface.
func (*ErrUpdateFailed) Unwrap ¶
func (err *ErrUpdateFailed) Unwrap() error
Unwrap satisfies the unwrap interface.
type ErrUpsertFailed ¶
type ErrUpsertFailed struct {
Err error
}
ErrUpsertFailed is the upsert failed error.
func (*ErrUpsertFailed) Error ¶
func (err *ErrUpsertFailed) Error() string
Error satisfies the error interface.
func (*ErrUpsertFailed) Unwrap ¶
func (err *ErrUpsertFailed) Unwrap() error
Unwrap satisfies the unwrap interface.
type Error ¶
type Error string
Error is an error.
const ( // ErrAlreadyExists is the already exists error. ErrAlreadyExists Error = "already exists" // ErrDoesNotExist is the does not exist error. ErrDoesNotExist Error = "does not exist" // ErrMarkedForDeletion is the marked for deletion error. ErrMarkedForDeletion Error = "marked for deletion" )
Error values.
type FindRunResult ¶
type FindRunResult struct {
ID string `json:"id"` // id
}
FindRunResult represents a row from 'find_run_result'.
func FindRunResultsByPathValue ¶
func FindRunResultsByPathValue(ctx context.Context, db DB, path string, value any) ([]*FindRunResult, error)
FindRunResultsByPathValue runs a custom query, returning results as FindRunResult.
type IndexRunsResult ¶
type IndexRunsResult struct {
ID string `json:"id"` // id
}
IndexRunsResult represents a row from 'index_runs_result'.
func GetIndexRunsResults ¶
func GetIndexRunsResults(ctx context.Context, db DB) ([]*IndexRunsResult, error)
GetIndexRunsResults runs a custom query, returning results as IndexRunsResult.
type Run ¶
type Run struct { ID string `json:"id"` // id UserID string `json:"user_id"` // user_id ThunkDigest string `json:"thunk_digest"` // thunk_digest StartTime Time `json:"start_time"` // start_time EndTime *Time `json:"end_time"` // end_time Succeeded sql.NullInt64 `json:"succeeded"` // succeeded Meta sql.NullString `json:"meta"` // meta // contains filtered or unexported fields }
Run represents a row from 'runs'.
func CreateThunkRun ¶
func RunByID ¶
RunByID retrieves a row from 'runs' as a Run.
Generated from index 'sqlite_autoindex_runs_1'.
func RunsByThunkDigest ¶
RunsByThunkDigest retrieves a row from 'runs' as a Run.
Generated from index 'idx_thunk_runs_digest'.
func RunsByUserID ¶
RunsByUserID retrieves a row from 'runs' as a Run.
Generated from index 'idx_thunk_runs_user_id'.
func (*Run) Deleted ¶
Deleted returns true when the Run has been marked for deletion from the database.
func (*Run) Thunk ¶
Thunk returns the Thunk associated with the Run's (ThunkDigest).
Generated from foreign key 'runs_thunk_digest_fkey'.
type Runtime ¶
type Runtime struct { UserID string `json:"user_id"` // user_id Name string `json:"name"` // name Os string `json:"os"` // os Arch string `json:"arch"` // arch ExpiresAt Time `json:"expires_at"` // expires_at Priority int `json:"priority"` // priority // contains filtered or unexported fields }
Runtime represents a row from 'runtimes'.
func RuntimeByUserIDName ¶
RuntimeByUserIDName retrieves a row from 'runtimes' as a Runtime.
Generated from index 'sqlite_autoindex_runtimes_1'.
func RuntimesByUserID ¶
RuntimesByUserID retrieves a row from 'runtimes' as a Runtime.
Generated from index 'idx_runtimes_user_id'.
func (*Runtime) Deleted ¶
Deleted returns true when the Runtime has been marked for deletion from the database.
type SchemaMigration ¶
type SchemaMigration struct { Version sql.NullString `json:"version"` // version Dirty sql.NullBool `json:"dirty"` // dirty }
SchemaMigration represents a row from 'schema_migrations'.
func SchemaMigrationByVersion ¶
func SchemaMigrationByVersion(ctx context.Context, db DB, version sql.NullString) (*SchemaMigration, error)
SchemaMigrationByVersion retrieves a row from 'schema_migrations' as a SchemaMigration.
Generated from index 'version_unique'.
type Service ¶
type Service struct { UserID string `json:"user_id"` // user_id RuntimeName string `json:"runtime_name"` // runtime_name Service string `json:"service"` // service Addr string `json:"addr"` // addr // contains filtered or unexported fields }
Service represents a row from 'services'.
func ServiceByRuntimeNameService ¶
func ServiceByRuntimeNameService(ctx context.Context, db DB, runtimeName, service string) (*Service, error)
ServiceByRuntimeNameService retrieves a row from 'services' as a Service.
Generated from index 'sqlite_autoindex_services_1'.
func ServiceByUserIDRuntimeNameService ¶
func ServiceByUserIDRuntimeNameService(ctx context.Context, db DB, userID, runtimeName, service string) (*Service, error)
ServiceByUserIDRuntimeNameService retrieves a row from 'services' as a Service.
Generated from index 'service_user_runtime_service_idx'.
func ServicesByUserIDRuntimeName ¶
func ServicesByUserIDRuntimeName(ctx context.Context, db DB, userID, runtimeName string) ([]*Service, error)
ServicesByUserIDRuntimeName retrieves a row from 'services' as a Service.
Generated from index 'idx_services_runtime_name'.
func (*Service) Deleted ¶
Deleted returns true when the Service has been marked for deletion from the database.
type Thunk ¶
type Thunk struct { Digest string `json:"digest"` // digest JSON []byte `json:"json"` // json // contains filtered or unexported fields }
Thunk represents a row from 'thunks'.
func ThunkByDigest ¶
ThunkByDigest retrieves a row from 'thunks' as a Thunk.
Generated from index 'sqlite_autoindex_thunks_1'.
func (*Thunk) Deleted ¶
Deleted returns true when the Thunk has been marked for deletion from the database.
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
Time is a SQLite3 Time that scans for the various timestamps values used by SQLite3 database drivers to store time.Time values.
type User ¶
type User struct { ID string `json:"id"` // id Login string `json:"login"` // login // contains filtered or unexported fields }
User represents a row from 'users'.
func UserByID ¶
UserByID retrieves a row from 'users' as a User.
Generated from index 'sqlite_autoindex_users_1'.
func (*User) Deleted ¶
Deleted returns true when the User has been marked for deletion from the database.
type Vertex ¶
type Vertex struct { RunID string `json:"run_id"` // run_id Digest string `json:"digest"` // digest Name string `json:"name"` // name Cached int `json:"cached"` // cached StartTime *Time `json:"start_time"` // start_time EndTime *Time `json:"end_time"` // end_time Error sql.NullString `json:"error"` // error // contains filtered or unexported fields }
Vertex represents a row from 'vertexes'.
func VertexByRunIDDigest ¶
VertexByRunIDDigest retrieves a row from 'vertexes' as a Vertex.
Generated from index 'sqlite_autoindex_vertexes_1'.
func VertexesByRunID ¶
VertexesByRunID retrieves a row from 'vertexes' as a Vertex.
Generated from index 'idx_vertexes_run_id'.
func (*Vertex) Deleted ¶
Deleted returns true when the Vertex has been marked for deletion from the database.
func (*Vertex) Run ¶
Run returns the Run associated with the Vertex's (RunID).
Generated from foreign key 'vertexes_run_id_fkey'.
type VertexEdge ¶
type VertexEdge struct { SourceDigest string `json:"source_digest"` // source_digest TargetDigest string `json:"target_digest"` // target_digest // contains filtered or unexported fields }
VertexEdge represents a row from 'vertex_edges'.
func VertexEdgeBySourceDigestTargetDigest ¶
func VertexEdgeBySourceDigestTargetDigest(ctx context.Context, db DB, sourceDigest, targetDigest string) (*VertexEdge, error)
VertexEdgeBySourceDigestTargetDigest retrieves a row from 'vertex_edges' as a VertexEdge.
Generated from index 'sqlite_autoindex_vertex_edges_1'.
func VertexEdgesBySourceDigest ¶
func VertexEdgesBySourceDigest(ctx context.Context, db DB, sourceDigest string) ([]*VertexEdge, error)
VertexEdgesBySourceDigest retrieves a row from 'vertex_edges' as a VertexEdge.
Generated from index 'idx_vertex_edges_source_digest'.
func VertexEdgesByTargetDigest ¶
func VertexEdgesByTargetDigest(ctx context.Context, db DB, targetDigest string) ([]*VertexEdge, error)
VertexEdgesByTargetDigest retrieves a row from 'vertex_edges' as a VertexEdge.
Generated from index 'idx_vertex_edges_target_digest'.
func (*VertexEdge) Delete ¶
func (ve *VertexEdge) Delete(ctx context.Context, db DB) error
Delete deletes the VertexEdge from the database.
func (*VertexEdge) Deleted ¶
func (ve *VertexEdge) Deleted() bool
Deleted returns true when the VertexEdge has been marked for deletion from the database.
func (*VertexEdge) Exists ¶
func (ve *VertexEdge) Exists() bool
Exists returns true when the VertexEdge exists in the database.