Documentation
¶
Index ¶
- Constants
- Variables
- func Create() (*sql.DB, error)
- type Backup
- func (m Backup) Count(db DB, options ListOptions) (int64, error)
- func (m *Backup) DecodeObject() *velero.Backup
- func (m *Backup) Delete(db DB) error
- func (m *Backup) EncodeObject(backup *velero.Backup)
- func (m *Backup) Get(db DB) error
- func (m *Backup) Insert(db DB) error
- func (m Backup) List(db DB, options ListOptions) ([]*Backup, error)
- func (m *Backup) Update(db DB) error
- func (m *Backup) With(object *velero.Backup)
- type Base
- type CR
- type Cluster
- func (m Cluster) Count(db DB, options ListOptions) (int64, error)
- func (m *Cluster) DecodeObject() *migapi.MigCluster
- func (m *Cluster) Delete(db DB) error
- func (m *Cluster) EncodeObject(cluster *migapi.MigCluster)
- func (m *Cluster) Get(db DB) error
- func (m *Cluster) Insert(db DB) error
- func (m Cluster) List(db DB, options ListOptions) ([]*Cluster, error)
- func (m *Cluster) Update(db DB) error
- func (m *Cluster) With(object *migapi.MigCluster)
- type DB
- type DirectImageMigration
- func (m DirectImageMigration) Count(db DB, options ListOptions) (int64, error)
- func (m *DirectImageMigration) DecodeObject() *migapi.DirectImageMigration
- func (m *DirectImageMigration) Delete(db DB) error
- func (m *DirectImageMigration) EncodeObject(dim *migapi.DirectImageMigration)
- func (m *DirectImageMigration) Get(db DB) error
- func (m *DirectImageMigration) Insert(db DB) error
- func (m DirectImageMigration) List(db DB, options ListOptions) ([]*DirectImageMigration, error)
- func (m *DirectImageMigration) Update(db DB) error
- func (m *DirectImageMigration) With(object *migapi.DirectImageMigration)
- type DirectImageStreamMigration
- func (m DirectImageStreamMigration) Count(db DB, options ListOptions) (int64, error)
- func (m *DirectImageStreamMigration) DecodeObject() *migapi.DirectImageStreamMigration
- func (m *DirectImageStreamMigration) Delete(db DB) error
- func (m *DirectImageStreamMigration) EncodeObject(dim *migapi.DirectImageStreamMigration)
- func (m *DirectImageStreamMigration) Get(db DB) error
- func (m *DirectImageStreamMigration) Insert(db DB) error
- func (m DirectImageStreamMigration) List(db DB, options ListOptions) ([]*DirectImageStreamMigration, error)
- func (m *DirectImageStreamMigration) Update(db DB) error
- func (m *DirectImageStreamMigration) With(object *migapi.DirectImageStreamMigration)
- type DirectVolumeMigration
- func (m DirectVolumeMigration) Count(db DB, options ListOptions) (int64, error)
- func (m *DirectVolumeMigration) DecodeObject() *migapi.DirectVolumeMigration
- func (m *DirectVolumeMigration) Delete(db DB) error
- func (m *DirectVolumeMigration) EncodeObject(dvm *migapi.DirectVolumeMigration)
- func (m *DirectVolumeMigration) Get(db DB) error
- func (m *DirectVolumeMigration) Insert(db DB) error
- func (m DirectVolumeMigration) List(db DB, options ListOptions) ([]*DirectVolumeMigration, error)
- func (m *DirectVolumeMigration) Update(db DB) error
- func (m *DirectVolumeMigration) With(object *migapi.DirectVolumeMigration)
- type DirectVolumeMigrationProgress
- func (m DirectVolumeMigrationProgress) Count(db DB, options ListOptions) (int64, error)
- func (m *DirectVolumeMigrationProgress) DecodeObject() *migapi.DirectVolumeMigrationProgress
- func (m *DirectVolumeMigrationProgress) Delete(db DB) error
- func (m *DirectVolumeMigrationProgress) EncodeObject(dvmp *migapi.DirectVolumeMigrationProgress)
- func (m *DirectVolumeMigrationProgress) Get(db DB) error
- func (m *DirectVolumeMigrationProgress) Insert(db DB) error
- func (m DirectVolumeMigrationProgress) List(db DB, options ListOptions) ([]*DirectVolumeMigrationProgress, error)
- func (m *DirectVolumeMigrationProgress) Update(db DB) error
- func (m *DirectVolumeMigrationProgress) With(object *migapi.DirectVolumeMigrationProgress)
- type Event
- func (m Event) Count(db DB, options ListOptions) (int64, error)
- func (m *Event) DecodeObject() *corev1.Event
- func (m *Event) Delete(db DB) error
- func (m *Event) EncodeObject(event *corev1.Event)
- func (m *Event) Get(db DB) error
- func (m *Event) Insert(db DB) error
- func (m Event) List(db DB, options ListOptions) ([]*Event, error)
- func (m *Event) Update(db DB) error
- func (m *Event) With(object *corev1.Event)
- type FK
- type Field
- func (f *Field) DDL() string
- func (f *Field) Empty() bool
- func (f *Field) Fk() *FK
- func (f *Field) Index() []string
- func (f *Field) Key() bool
- func (f *Field) Mutable() bool
- func (f *Field) Param() string
- func (f *Field) Pk() bool
- func (f *Field) Ptr() interface{}
- func (f *Field) Pull() interface{}
- func (f *Field) Push()
- func (f *Field) Unique() []string
- func (f *Field) Validate() error
- type Hook
- func (m Hook) Count(db DB, options ListOptions) (int64, error)
- func (m *Hook) DecodeObject() *migapi.MigHook
- func (m *Hook) Delete(db DB) error
- func (m *Hook) EncodeObject(dim *migapi.MigHook)
- func (m *Hook) Get(db DB) error
- func (m *Hook) Insert(db DB) error
- func (m Hook) List(db DB, options ListOptions) ([]*Hook, error)
- func (m *Hook) Update(db DB) error
- func (m *Hook) With(object *migapi.MigHook)
- type Job
- func (m Job) Count(db DB, options ListOptions) (int64, error)
- func (m *Job) DecodeObject() *batchv1.Job
- func (m *Job) Delete(db DB) error
- func (m *Job) EncodeObject(job *batchv1.Job)
- func (m *Job) Get(db DB) error
- func (m *Job) Insert(db DB) error
- func (m Job) List(db DB, options ListOptions) ([]*Job, error)
- func (m *Job) Update(db DB) error
- func (m *Job) With(object *batchv1.Job)
- type Label
- type Labels
- type ListOptions
- type Meta
- type Migration
- func (m Migration) Count(db DB, options ListOptions) (int64, error)
- func (m *Migration) DecodeObject() *migapi.MigMigration
- func (m *Migration) Delete(db DB) error
- func (m *Migration) EncodeObject(migration *migapi.MigMigration)
- func (m *Migration) Get(db DB) error
- func (m *Migration) Insert(db DB) error
- func (m Migration) List(db DB, options ListOptions) ([]*Migration, error)
- func (m *Migration) Update(db DB) error
- func (m *Migration) With(object *migapi.MigMigration)
- type Model
- type Namespace
- func (m Namespace) Count(db DB, options ListOptions) (int64, error)
- func (m *Namespace) Delete(db DB) error
- func (m *Namespace) Get(db DB) error
- func (m *Namespace) Insert(db DB) error
- func (m Namespace) List(db DB, options ListOptions) ([]*Namespace, error)
- func (m *Namespace) Update(db DB) error
- func (m *Namespace) With(object *v1.Namespace)
- type PV
- func (m PV) Count(db DB, options ListOptions) (int64, error)
- func (m *PV) DecodeObject() *v1.PersistentVolume
- func (m *PV) Delete(db DB) error
- func (m *PV) EncodeObject(pv *v1.PersistentVolume)
- func (m *PV) Get(db DB) error
- func (m *PV) Insert(db DB) error
- func (m PV) List(db DB, options ListOptions) ([]*PV, error)
- func (m *PV) Update(db DB) error
- func (m *PV) With(object *v1.PersistentVolume)
- type PVC
- func (m PVC) Count(db DB, options ListOptions) (int64, error)
- func (m *PVC) DecodeObject() *v1.PersistentVolumeClaim
- func (m *PVC) Delete(db DB) error
- func (m *PVC) EncodeObject(pvc *v1.PersistentVolumeClaim)
- func (m *PVC) Get(db DB) error
- func (m *PVC) Insert(db DB) error
- func (m PVC) List(db DB, options ListOptions) ([]*PVC, error)
- func (m *PVC) Update(db DB) error
- func (m *PVC) With(object *v1.PersistentVolumeClaim)
- type Page
- type Plan
- func (m Plan) Count(db DB, options ListOptions) (int64, error)
- func (m *Plan) DecodeObject() *migapi.MigPlan
- func (m *Plan) Delete(db DB) error
- func (m *Plan) EncodeObject(plan *migapi.MigPlan)
- func (m *Plan) Get(db DB) error
- func (m *Plan) Insert(db DB) error
- func (m Plan) List(db DB, options ListOptions) ([]*Plan, error)
- func (m *Plan) Update(db DB) error
- func (m *Plan) With(object *migapi.MigPlan)
- type Pod
- func (m Pod) Count(db DB, options ListOptions) (int64, error)
- func (m *Pod) DecodeObject() *v1.Pod
- func (m *Pod) Delete(db DB) error
- func (m *Pod) EncodeObject(pod *v1.Pod)
- func (m *Pod) Get(db DB) error
- func (m *Pod) Insert(db DB) error
- func (m Pod) List(db DB, options ListOptions) ([]*Pod, error)
- func (m *Pod) Update(db DB) error
- func (m *Pod) With(object *v1.Pod)
- type PodVolumeBackup
- func (m PodVolumeBackup) Count(db DB, options ListOptions) (int64, error)
- func (m *PodVolumeBackup) DecodeObject() *velero.PodVolumeBackup
- func (m *PodVolumeBackup) Delete(db DB) error
- func (m *PodVolumeBackup) EncodeObject(backup *velero.PodVolumeBackup)
- func (m *PodVolumeBackup) Get(db DB) error
- func (m *PodVolumeBackup) Insert(db DB) error
- func (m PodVolumeBackup) List(db DB, options ListOptions) ([]*PodVolumeBackup, error)
- func (m *PodVolumeBackup) Update(db DB) error
- func (m *PodVolumeBackup) With(object *velero.PodVolumeBackup)
- type PodVolumeRestore
- func (m PodVolumeRestore) Count(db DB, options ListOptions) (int64, error)
- func (m *PodVolumeRestore) DecodeObject() *velero.PodVolumeRestore
- func (m *PodVolumeRestore) Delete(db DB) error
- func (m *PodVolumeRestore) EncodeObject(restore *velero.PodVolumeRestore)
- func (m *PodVolumeRestore) Get(db DB) error
- func (m *PodVolumeRestore) Insert(db DB) error
- func (m PodVolumeRestore) List(db DB, options ListOptions) ([]*PodVolumeRestore, error)
- func (m *PodVolumeRestore) Update(db DB) error
- func (m *PodVolumeRestore) With(object *velero.PodVolumeRestore)
- type Restore
- func (m Restore) Count(db DB, options ListOptions) (int64, error)
- func (m *Restore) DecodeObject() *velero.Restore
- func (m *Restore) Delete(db DB) error
- func (m *Restore) EncodeObject(restore *velero.Restore)
- func (m *Restore) Get(db DB) error
- func (m *Restore) Insert(db DB) error
- func (m Restore) List(db DB, options ListOptions) ([]*Restore, error)
- func (m *Restore) Update(db DB) error
- func (m *Restore) With(object *velero.Restore)
- type Route
- func (m Route) Count(db DB, options ListOptions) (int64, error)
- func (m *Route) DecodeObject() *v1.Route
- func (m *Route) Delete(db DB) error
- func (m *Route) EncodeObject(pod *v1.Route)
- func (m *Route) Get(db DB) error
- func (m *Route) Insert(db DB) error
- func (m Route) List(db DB, options ListOptions) ([]*Route, error)
- func (m *Route) Update(db DB) error
- func (m *Route) With(object *v1.Route)
- type Row
- type Service
- func (m Service) Count(db DB, options ListOptions) (int64, error)
- func (m *Service) DecodeObject() *v1.Service
- func (m *Service) Delete(db DB) error
- func (m *Service) EncodeObject(service *v1.Service)
- func (m *Service) Get(db DB) error
- func (m *Service) Insert(db DB) error
- func (m Service) List(db DB, options ListOptions) ([]*Service, error)
- func (m *Service) Update(db DB) error
- func (m *Service) With(object *v1.Service)
- type StorageClass
- func (m StorageClass) Count(db DB, options ListOptions) (int64, error)
- func (m *StorageClass) DecodeObject() *v1.StorageClass
- func (m *StorageClass) Delete(db DB) error
- func (m *StorageClass) EncodeObject(StorageClass *v1.StorageClass)
- func (m *StorageClass) Get(db DB) error
- func (m *StorageClass) Insert(db DB) error
- func (m StorageClass) List(db DB, options ListOptions) ([]*StorageClass, error)
- func (m *StorageClass) Update(db DB) error
- func (m *StorageClass) With(object *v1.StorageClass)
- type Table
- func (t Table) Constraints(fields []*Field) []string
- func (t Table) Count(model interface{}, options ListOptions) (int64, error)
- func (t Table) DDL(model interface{}) ([]string, error)
- func (t Table) Delete(model interface{}) error
- func (t Table) DeleteLabels(model Model) error
- func (t Table) Fields(model interface{}) ([]*Field, error)
- func (t Table) Get(model interface{}) error
- func (t Table) Insert(model interface{}) error
- func (t Table) InsertLabels(model Model) error
- func (t Table) KeyFields(fields []*Field) []*Field
- func (t Table) List(model interface{}, options ListOptions) ([]interface{}, error)
- func (t Table) MutableFields(fields []*Field) []*Field
- func (t Table) Name(model interface{}) string
- func (t Table) NotEmptyFields(fields []*Field) []*Field
- func (t Table) Params(fields []*Field) []interface{}
- func (t Table) PkField(fields []*Field) *Field
- func (t Table) ReplaceLabels(model Model) error
- func (t Table) Update(model interface{}) error
- type TmplData
- type VirtualMachine
- func (m VirtualMachine) Count(db DB, options ListOptions) (int64, error)
- func (m *VirtualMachine) DecodeObject() *virtv1.VirtualMachine
- func (m *VirtualMachine) Delete(db DB) error
- func (m *VirtualMachine) EncodeObject(virtualMachine *virtv1.VirtualMachine)
- func (m *VirtualMachine) Get(db DB) error
- func (m *VirtualMachine) Insert(db DB) error
- func (m VirtualMachine) List(db DB, options ListOptions) ([]*VirtualMachine, error)
- func (m *VirtualMachine) Update(db DB) error
- func (m *VirtualMachine) With(object *virtv1.VirtualMachine)
Constants ¶
const (
Pragma = "PRAGMA foreign_keys = ON"
)
const (
Tag = "sql"
)
Variables ¶
var DeleteSQL = `` /* 198-byte string literal not displayed */
var FkRegex = regexp.MustCompile(`(fk):(.+)(\()(.+)(\))`)
Regex used for `fk:<table>(field)` tags.
var GetSQL = `` /* 296-byte string literal not displayed */
var IndexDDL = `` /* 141-byte string literal not displayed */
var IndexRegex = regexp.MustCompile(`(index)(\()(.+)(\))`)
Regex used for `index(group)` tags.
var InsertSQL = `` /* 196-byte string literal not displayed */
SQL templates.
var ListSQL = `` /* 834-byte string literal not displayed */
var Mutex sync.RWMutex
DB driver cannot be used for concurrent writes. Model methods must use:
- Insert()
- Update()
- Delete()
And, all transactions.
var NotFound = sql.ErrNoRows
Not found error.
var Settings = &settings.Settings
Application settings.
var TableDDL = `` /* 177-byte string literal not displayed */
DDL templates.
var UniqueRegex = regexp.MustCompile(`(unique)(\()(.+)(\))`)
Regex used for `unique(group)` tags.
var UpdateSQL = `` /* 292-byte string literal not displayed */
Functions ¶
Types ¶
type Backup ¶
type Backup struct {
Base
}
Backup model
func (Backup) Count ¶
func (m Backup) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
func (*Backup) EncodeObject ¶
Encode the object.
type Base ¶
type Base struct { // Primary key (digest). PK string `sql:"pk"` // The k8s resource UID. UID string `sql:"const,unique(a)"` // The k8s resourceVersion. Version string `sql:""` // The k8s resource namespace. Namespace string `sql:"const,unique(b),key"` // The k8s resource name. Name string `sql:"const,unique(b),key"` // The raw json-encoded k8s resource. Object string `sql:""` // The (optional) cluster foreign key. Cluster string `sql:"const,fk:Cluster(pk),unique(a),unique(b),key"` // contains filtered or unexported fields }
Base Model
func (*Base) GetCluster ¶
Fetch referenced cluster.
type CR ¶
type CR struct { // Primary key (digest). PK string `sql:"pk"` // The k8s resource UID. UID string `sql:"const,unique(a)"` // The k8s resourceVersion. Version string `sql:""` // The k8s resource namespace. Namespace string `sql:"const,unique(b),key"` // The k8s resource name. Name string `sql:"const,unique(b),key"` // The raw json-encoded k8s resource. Object string `sql:""` // contains filtered or unexported fields }
Custom Resource.
type Cluster ¶
type Cluster struct {
CR
}
Cluster model.
func (Cluster) Count ¶
func (m Cluster) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
func (*Cluster) DecodeObject ¶
func (m *Cluster) DecodeObject() *migapi.MigCluster
Decode the object.
func (*Cluster) EncodeObject ¶
func (m *Cluster) EncodeObject(cluster *migapi.MigCluster)
Encode the object.
func (Cluster) List ¶
func (m Cluster) List(db DB, options ListOptions) ([]*Cluster, error)
Fetch the model from the DB.
func (*Cluster) With ¶
func (m *Cluster) With(object *migapi.MigCluster)
Update the model `with` a MigCluster.
type DB ¶
type DB interface { Exec(string, ...interface{}) (sql.Result, error) Query(string, ...interface{}) (*sql.Rows, error) QueryRow(string, ...interface{}) *sql.Row }
Database interface. Support model methods taking either sql.DB or sql.Tx.
type DirectImageMigration ¶
type DirectImageMigration struct {
CR
}
DirectImageMigration model.
func (DirectImageMigration) Count ¶
func (m DirectImageMigration) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
func (*DirectImageMigration) DecodeObject ¶
func (m *DirectImageMigration) DecodeObject() *migapi.DirectImageMigration
Decode the object.
func (*DirectImageMigration) Delete ¶
func (m *DirectImageMigration) Delete(db DB) error
Delete the model in the DB.
func (*DirectImageMigration) EncodeObject ¶
func (m *DirectImageMigration) EncodeObject(dim *migapi.DirectImageMigration)
Encode the object.
func (*DirectImageMigration) Get ¶
func (m *DirectImageMigration) Get(db DB) error
Fetch the model from the DB.
func (*DirectImageMigration) Insert ¶
func (m *DirectImageMigration) Insert(db DB) error
Insert the model into the DB.
func (DirectImageMigration) List ¶
func (m DirectImageMigration) List(db DB, options ListOptions) ([]*DirectImageMigration, error)
Fetch the model from the DB.
func (*DirectImageMigration) Update ¶
func (m *DirectImageMigration) Update(db DB) error
Update the model in the DB.
func (*DirectImageMigration) With ¶
func (m *DirectImageMigration) With(object *migapi.DirectImageMigration)
Update the model `with` a DirectImageMigration.
type DirectImageStreamMigration ¶
type DirectImageStreamMigration struct {
CR
}
DirectImageStreamMigration model.
func (DirectImageStreamMigration) Count ¶
func (m DirectImageStreamMigration) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
func (*DirectImageStreamMigration) DecodeObject ¶
func (m *DirectImageStreamMigration) DecodeObject() *migapi.DirectImageStreamMigration
Decode the object.
func (*DirectImageStreamMigration) Delete ¶
func (m *DirectImageStreamMigration) Delete(db DB) error
Delete the model in the DB.
func (*DirectImageStreamMigration) EncodeObject ¶
func (m *DirectImageStreamMigration) EncodeObject(dim *migapi.DirectImageStreamMigration)
Encode the object.
func (*DirectImageStreamMigration) Get ¶
func (m *DirectImageStreamMigration) Get(db DB) error
Fetch the model from the DB.
func (*DirectImageStreamMigration) Insert ¶
func (m *DirectImageStreamMigration) Insert(db DB) error
Insert the model into the DB.
func (DirectImageStreamMigration) List ¶
func (m DirectImageStreamMigration) List(db DB, options ListOptions) ([]*DirectImageStreamMigration, error)
Fetch the model from the DB.
func (*DirectImageStreamMigration) Update ¶
func (m *DirectImageStreamMigration) Update(db DB) error
Update the model in the DB.
func (*DirectImageStreamMigration) With ¶
func (m *DirectImageStreamMigration) With(object *migapi.DirectImageStreamMigration)
Update the model `with` a DirectImageMigration.
type DirectVolumeMigration ¶
type DirectVolumeMigration struct {
CR
}
DirectVolumeMigration model.
func (DirectVolumeMigration) Count ¶
func (m DirectVolumeMigration) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
func (*DirectVolumeMigration) DecodeObject ¶
func (m *DirectVolumeMigration) DecodeObject() *migapi.DirectVolumeMigration
Decode the object.
func (*DirectVolumeMigration) Delete ¶
func (m *DirectVolumeMigration) Delete(db DB) error
Delete the model in the DB.
func (*DirectVolumeMigration) EncodeObject ¶
func (m *DirectVolumeMigration) EncodeObject(dvm *migapi.DirectVolumeMigration)
Encode the object.
func (*DirectVolumeMigration) Get ¶
func (m *DirectVolumeMigration) Get(db DB) error
Fetch the model from the DB.
func (*DirectVolumeMigration) Insert ¶
func (m *DirectVolumeMigration) Insert(db DB) error
Insert the model into the DB.
func (DirectVolumeMigration) List ¶
func (m DirectVolumeMigration) List(db DB, options ListOptions) ([]*DirectVolumeMigration, error)
Fetch the model from the DB.
func (*DirectVolumeMigration) Update ¶
func (m *DirectVolumeMigration) Update(db DB) error
Update the model in the DB.
func (*DirectVolumeMigration) With ¶
func (m *DirectVolumeMigration) With(object *migapi.DirectVolumeMigration)
Update the model `with` a DirectVolumeMigration.
type DirectVolumeMigrationProgress ¶
type DirectVolumeMigrationProgress struct {
CR
}
DirectVolumeMigrationProgress model.
func (DirectVolumeMigrationProgress) Count ¶
func (m DirectVolumeMigrationProgress) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
func (*DirectVolumeMigrationProgress) DecodeObject ¶
func (m *DirectVolumeMigrationProgress) DecodeObject() *migapi.DirectVolumeMigrationProgress
Decode the object.
func (*DirectVolumeMigrationProgress) Delete ¶
func (m *DirectVolumeMigrationProgress) Delete(db DB) error
Delete the model in the DB.
func (*DirectVolumeMigrationProgress) EncodeObject ¶
func (m *DirectVolumeMigrationProgress) EncodeObject(dvmp *migapi.DirectVolumeMigrationProgress)
Encode the object.
func (*DirectVolumeMigrationProgress) Get ¶
func (m *DirectVolumeMigrationProgress) Get(db DB) error
Fetch the model from the DB.
func (*DirectVolumeMigrationProgress) Insert ¶
func (m *DirectVolumeMigrationProgress) Insert(db DB) error
Insert the model into the DB.
func (DirectVolumeMigrationProgress) List ¶
func (m DirectVolumeMigrationProgress) List(db DB, options ListOptions) ([]*DirectVolumeMigrationProgress, error)
Fetch the model from the DB.
func (*DirectVolumeMigrationProgress) Update ¶
func (m *DirectVolumeMigrationProgress) Update(db DB) error
Update the model in the DB.
func (*DirectVolumeMigrationProgress) With ¶
func (m *DirectVolumeMigrationProgress) With(object *migapi.DirectVolumeMigrationProgress)
Update the model `with` a DirectImageMigration.
type Event ¶
type Event struct {
Base
}
Event model.
func (Event) Count ¶
func (m Event) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
type Field ¶
type Field struct { // reflect.Value of the field. Value *reflect.Value // Tags. Tag string // Field name. Name string // contains filtered or unexported fields }
Model (struct) Field
func (*Field) Pull ¶
func (f *Field) Pull() interface{}
Pull from model. Populate the appropriate `staging` field using the model field value.
type Hook ¶
type Hook struct {
CR
}
Hook model.
type Job ¶
type Job struct {
Base
}
Job model.
type ListOptions ¶
type ListOptions struct { // Row count. Count bool // Labels. Labels Labels // Pagination. Page *Page // Sort by field position. Sort []int }
List options.
type Meta ¶
type Meta struct { // Primary key. PK string // The k8s resource UID. UID string // The k8s resourceVersion. Version uint64 // The k8s resource namespace. Namespace string // The k8s resource name. Name string }
Model meta-data.
type Migration ¶
type Migration struct {
CR
}
Migration model
func (Migration) Count ¶
func (m Migration) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
func (*Migration) DecodeObject ¶
func (m *Migration) DecodeObject() *migapi.MigMigration
Decode the object.
func (*Migration) EncodeObject ¶
func (m *Migration) EncodeObject(migration *migapi.MigMigration)
Encode the object.
func (Migration) List ¶
func (m Migration) List(db DB, options ListOptions) ([]*Migration, error)
Fetch the model from the DB.
func (*Migration) With ¶
func (m *Migration) With(object *migapi.MigMigration)
Update the model `with` a MigMigration.
type Model ¶
type Model interface { // Get the primary key. Pk() string // Set the primary key based on attributes. SetPk() // Get model meta-data. Meta() *Meta // Fetch the model from the DB and update the fields. // Returns error=`NotFound` when not found. Get(DB) error // Insert into the DB. Insert(DB) error // Update in the DB. Update(DB) error // Delete from the DB. Delete(DB) error // Get labels. Labels() Labels }
Model Each model represents a table in the DB.
type Namespace ¶
type Namespace struct {
Base
}
Namespace model.
func (Namespace) Count ¶
func (m Namespace) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
type PV ¶
type PV struct {
Base
}
PV model.
func (PV) List ¶
func (m PV) List(db DB, options ListOptions) ([]*PV, error)
Fetch the from in the DB.
func (*PV) With ¶
func (m *PV) With(object *v1.PersistentVolume)
Update the model `with` a k8s PersistentVolume.
type PVC ¶
type PVC struct {
Base
}
PVC model.
func (*PVC) DecodeObject ¶
func (m *PVC) DecodeObject() *v1.PersistentVolumeClaim
Encode the object.
func (*PVC) EncodeObject ¶
func (m *PVC) EncodeObject(pvc *v1.PersistentVolumeClaim)
Encode the object.
func (PVC) List ¶
func (m PVC) List(db DB, options ListOptions) ([]*PVC, error)
Fetch the from in the DB.
func (*PVC) With ¶
func (m *PVC) With(object *v1.PersistentVolumeClaim)
Update the model `with` a k8s PVC.
type Plan ¶
type Plan struct {
CR
}
Plan model
type Pod ¶
type Pod struct {
Base
}
Pod model
type PodVolumeBackup ¶
type PodVolumeBackup struct {
Base
}
Backup model
func (PodVolumeBackup) Count ¶
func (m PodVolumeBackup) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
func (*PodVolumeBackup) DecodeObject ¶
func (m *PodVolumeBackup) DecodeObject() *velero.PodVolumeBackup
Decode the object.
func (*PodVolumeBackup) Delete ¶
func (m *PodVolumeBackup) Delete(db DB) error
Delete the model in the DB.
func (*PodVolumeBackup) EncodeObject ¶
func (m *PodVolumeBackup) EncodeObject(backup *velero.PodVolumeBackup)
Encode the object.
func (*PodVolumeBackup) Get ¶
func (m *PodVolumeBackup) Get(db DB) error
Fetch the model from the DB.
func (*PodVolumeBackup) Insert ¶
func (m *PodVolumeBackup) Insert(db DB) error
Insert the model into the DB.
func (PodVolumeBackup) List ¶
func (m PodVolumeBackup) List(db DB, options ListOptions) ([]*PodVolumeBackup, error)
Fetch the model from the DB.
func (*PodVolumeBackup) Update ¶
func (m *PodVolumeBackup) Update(db DB) error
Update the model in the DB.
func (*PodVolumeBackup) With ¶
func (m *PodVolumeBackup) With(object *velero.PodVolumeBackup)
Update the model `with` a Backup.
type PodVolumeRestore ¶
type PodVolumeRestore struct {
Base
}
Restore model
func (PodVolumeRestore) Count ¶
func (m PodVolumeRestore) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
func (*PodVolumeRestore) DecodeObject ¶
func (m *PodVolumeRestore) DecodeObject() *velero.PodVolumeRestore
Decode the object.
func (*PodVolumeRestore) Delete ¶
func (m *PodVolumeRestore) Delete(db DB) error
Delete the model in the DB.
func (*PodVolumeRestore) EncodeObject ¶
func (m *PodVolumeRestore) EncodeObject(restore *velero.PodVolumeRestore)
Encode the object.
func (*PodVolumeRestore) Get ¶
func (m *PodVolumeRestore) Get(db DB) error
Fetch the model from the DB.
func (*PodVolumeRestore) Insert ¶
func (m *PodVolumeRestore) Insert(db DB) error
Insert the model into the DB.
func (PodVolumeRestore) List ¶
func (m PodVolumeRestore) List(db DB, options ListOptions) ([]*PodVolumeRestore, error)
Fetch the model from the DB.
func (*PodVolumeRestore) Update ¶
func (m *PodVolumeRestore) Update(db DB) error
Update the model in the DB.
func (*PodVolumeRestore) With ¶
func (m *PodVolumeRestore) With(object *velero.PodVolumeRestore)
Update the model `with` a Restore.
type Restore ¶
type Restore struct {
Base
}
Restore model
func (Restore) Count ¶
func (m Restore) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
func (*Restore) EncodeObject ¶
Encode the object.
type Route ¶
type Route struct {
Base
}
Route model
func (Route) Count ¶
func (m Route) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
type Row ¶
type Row interface {
Scan(...interface{}) error
}
Database interface. Support model `Scan` taking either sql.Row or sql.Rows.
type Service ¶
type Service struct {
Base
}
Service model.
func (Service) Count ¶
func (m Service) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
func (*Service) EncodeObject ¶
Encode the object.
type StorageClass ¶
type StorageClass struct {
Base
}
StorageClass model.
func (StorageClass) Count ¶
func (m StorageClass) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
func (*StorageClass) DecodeObject ¶
func (m *StorageClass) DecodeObject() *v1.StorageClass
Encode the object.
func (*StorageClass) Delete ¶
func (m *StorageClass) Delete(db DB) error
Delete the model in the DB.
func (*StorageClass) EncodeObject ¶
func (m *StorageClass) EncodeObject(StorageClass *v1.StorageClass)
Encode the object.
func (*StorageClass) Insert ¶
func (m *StorageClass) Insert(db DB) error
Insert the model into the DB.
func (StorageClass) List ¶
func (m StorageClass) List(db DB, options ListOptions) ([]*StorageClass, error)
Fetch the from in the DB.
func (*StorageClass) Update ¶
func (m *StorageClass) Update(db DB) error
Update the model in the DB.
func (*StorageClass) With ¶
func (m *StorageClass) With(object *v1.StorageClass)
Update the model `with` a k8s StorageClass.
type Table ¶
type Table struct { // Database connection. Db DB }
Represents a table in the DB. Using reflect, the model is inspected to determine the table name and columns. The column definition is specified using field tags:
pk - Primary key. key - Natural key. fk:<table>(field) - Foreign key. unique(<group>) - Unique constraint collated by <group>. index(<group>) - Non-unique indexed fields collated by <group>. const - Not updated.
func (Table) Count ¶
func (t Table) Count(model interface{}, options ListOptions) (int64, error)
Count the models in the DB. Qualified by the model field values and list options. Expects natural keys to be set. Else, ALL models counted.
func (Table) Delete ¶
Delete the model in the DB. Expects the primary key (PK) or natural keys to be set.
func (Table) DeleteLabels ¶
Delete labels for a model in the DB.
func (Table) Get ¶
Get the model in the DB. Expects the primary key (PK) or natural keys to be set. Fetch the row and populate the fields in the model.
func (Table) InsertLabels ¶
Insert labels for the model into the DB.
func (Table) List ¶
func (t Table) List(model interface{}, options ListOptions) ([]interface{}, error)
List the model in the DB. Qualified by the model field values and list options. Expects natural keys to be set. Else, ALL models fetched.
func (Table) MutableFields ¶
Get the mutable `Fields` for the model.
func (Table) NotEmptyFields ¶
Get the populated `Fields` for the model.
type TmplData ¶
type TmplData struct { // Table name. Table string // Index name. Index string // Fields. Fields []*Field // Constraint DDL. Constraints []string // Natural key fields. Keys []*Field // Set (not empty) fields. NotEmpty []*Field // Primary key. Pk *Field // List options. Options ListOptions // Row count. Count bool }
Template data.
type VirtualMachine ¶
type VirtualMachine struct {
Base
}
StorageClass model.
func (VirtualMachine) Count ¶
func (m VirtualMachine) Count(db DB, options ListOptions) (int64, error)
Count in the DB.
func (*VirtualMachine) DecodeObject ¶
func (m *VirtualMachine) DecodeObject() *virtv1.VirtualMachine
Encode the object.
func (*VirtualMachine) Delete ¶
func (m *VirtualMachine) Delete(db DB) error
Delete the model in the DB.
func (*VirtualMachine) EncodeObject ¶
func (m *VirtualMachine) EncodeObject(virtualMachine *virtv1.VirtualMachine)
Encode the object.
func (*VirtualMachine) Insert ¶
func (m *VirtualMachine) Insert(db DB) error
Insert the model into the DB.
func (VirtualMachine) List ¶
func (m VirtualMachine) List(db DB, options ListOptions) ([]*VirtualMachine, error)
Fetch the virtual machine list from in the DB.
func (*VirtualMachine) Update ¶
func (m *VirtualMachine) Update(db DB) error
Update the model in the DB.
func (*VirtualMachine) With ¶
func (m *VirtualMachine) With(object *virtv1.VirtualMachine)
Update the model `with` a k8s StorageClass.