sql: Refactor use of tables
This commit is contained in:
parent
85fe5b5c5a
commit
73d821e320
19 changed files with 191 additions and 83 deletions
39
internal/dis/component/sql/tables.go
Normal file
39
internal/dis/component/sql/tables.go
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package sql
|
||||
|
||||
import (
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/models"
|
||||
"github.com/tkw1536/goprogram/lib/reflectx"
|
||||
)
|
||||
|
||||
// This file defines additional tables used by multiple components
|
||||
|
||||
type InstanceTable struct {
|
||||
component.Base
|
||||
}
|
||||
|
||||
var (
|
||||
_ component.Table = (*InstanceTable)(nil)
|
||||
)
|
||||
|
||||
func (*InstanceTable) TableInfo() component.TableInfo {
|
||||
return component.TableInfo{
|
||||
Model: reflectx.TypeOf[models.Instance](),
|
||||
Name: models.InstanceTable,
|
||||
}
|
||||
}
|
||||
|
||||
type LockTable struct {
|
||||
component.Base
|
||||
}
|
||||
|
||||
var (
|
||||
_ component.Table = (*LockTable)(nil)
|
||||
)
|
||||
|
||||
func (*LockTable) TableInfo() component.TableInfo {
|
||||
return component.TableInfo{
|
||||
Model: reflectx.TypeOf[models.Lock](),
|
||||
Name: models.LockTable,
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue