Documentation ¶
Index ¶
- func DbGetChildSlice[Parent interface{}, Schema interface{}](ctx context.Context, db *gorm.DB, parent *Parent, columnName string, ...) ([]Schema, error)
- func DbGetFromId[T interface{}, N int32 | int64 | uint](ctx context.Context, db *gorm.DB, id N) (T, error)
- func DbGetManyFromIds[T interface{}, N int32 | int64 | uint](ctx context.Context, db *gorm.DB, ids []N) ([]T, error)
- func DbIdsOfAssoc[N int32 | int64 | uint](ctx context.Context, db *gorm.DB, model interface{}, column string) ([]N, error)
- func ModelAuthHealthEntry(ctx context.Context, db *gorm.DB, principal *User, schema *HealthEntry) error
- func OpenDb(db_url string) (*gorm.DB, error)
- type Category
- type CategoryMultiChoice
- func (choice *CategoryMultiChoice) FromModel(_ context.Context, _ *gorm.DB, model models.CategoryMultiChoice) error
- func (choice CategoryMultiChoice) GetOwnerID(ctx context.Context, db *gorm.DB) uint
- func (choice *CategoryMultiChoice) GetParent(ctx context.Context, db *gorm.DB) (Category, error)
- func (choice *CategoryMultiChoice) SetParentId(id uint)
- func (choice *CategoryMultiChoice) ToModel(context.Context, *gorm.DB) (models.CategoryMultiChoice, error)
- type CategorySingleChoiceGroup
- func (choice *CategorySingleChoiceGroup) FromModel(_ context.Context, _ *gorm.DB, model models.CategorySingleChoiceGroup) error
- func (choice CategorySingleChoiceGroup) GetOwnerID(ctx context.Context, db *gorm.DB) uint
- func (choice *CategorySingleChoiceGroup) GetParent(ctx context.Context, db *gorm.DB) (Category, error)
- func (choice *CategorySingleChoiceGroup) SetParentId(id uint)
- func (choice *CategorySingleChoiceGroup) ToModel(context.Context, *gorm.DB) (models.CategorySingleChoiceGroup, error)
- type CategorySingleChoiceItem
- func (choice *CategorySingleChoiceItem) FromModel(_ context.Context, _ *gorm.DB, model models.CategorySingleChoice) error
- func (choice CategorySingleChoiceItem) GetOwnerID(ctx context.Context, db *gorm.DB) uint
- func (choice *CategorySingleChoiceItem) GetParent(ctx context.Context, db *gorm.DB) (CategorySingleChoiceGroup, error)
- func (choice *CategorySingleChoiceItem) SetParentId(id uint)
- func (choice *CategorySingleChoiceItem) ToModel(context.Context, *gorm.DB) (models.CategorySingleChoice, error)
- type HealthEntry
- func (entry *HealthEntry) FromModel(ctx context.Context, db *gorm.DB, model models.Entry) error
- func (entry HealthEntry) GetOwnerID(context.Context, *gorm.DB) uint
- func (entry *HealthEntry) SetParentId(id uint)
- func (entry *HealthEntry) ToModel(ctx context.Context, db *gorm.DB) (models.Entry, error)
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DbGetChildSlice ¶
func DbGetFromId ¶
func DbGetManyFromIds ¶
func DbIdsOfAssoc ¶
func ModelAuthHealthEntry ¶
Types ¶
type Category ¶
type Category struct { gorm.Model UserID uint Title string MultiChoices []CategoryMultiChoice `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` SingleChoices []CategorySingleChoiceGroup `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` }
func (*Category) SetParentId ¶
type CategoryMultiChoice ¶
type CategoryMultiChoice struct { gorm.Model CategoryID uint Title string Description string Entries []*HealthEntry `gorm:"many2many:entry_multi_choices;"` }
func (*CategoryMultiChoice) FromModel ¶
func (choice *CategoryMultiChoice) FromModel(_ context.Context, _ *gorm.DB, model models.CategoryMultiChoice) error
func (CategoryMultiChoice) GetOwnerID ¶
func (*CategoryMultiChoice) SetParentId ¶
func (choice *CategoryMultiChoice) SetParentId(id uint)
func (*CategoryMultiChoice) ToModel ¶
func (choice *CategoryMultiChoice) ToModel(context.Context, *gorm.DB) (models.CategoryMultiChoice, error)
type CategorySingleChoiceGroup ¶
type CategorySingleChoiceGroup struct { gorm.Model CategoryID uint Title string Description string Choices []CategorySingleChoiceItem `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` }
func (*CategorySingleChoiceGroup) FromModel ¶
func (choice *CategorySingleChoiceGroup) FromModel(_ context.Context, _ *gorm.DB, model models.CategorySingleChoiceGroup) error
func (CategorySingleChoiceGroup) GetOwnerID ¶
func (*CategorySingleChoiceGroup) SetParentId ¶
func (choice *CategorySingleChoiceGroup) SetParentId(id uint)
func (*CategorySingleChoiceGroup) ToModel ¶
func (choice *CategorySingleChoiceGroup) ToModel(context.Context, *gorm.DB) (models.CategorySingleChoiceGroup, error)
type CategorySingleChoiceItem ¶
type CategorySingleChoiceItem struct { gorm.Model CategorySingleChoiceGroupID uint Title string Description string Entries []*HealthEntry `gorm:"many2many:entry_single_choices;"` }
func (*CategorySingleChoiceItem) FromModel ¶
func (choice *CategorySingleChoiceItem) FromModel(_ context.Context, _ *gorm.DB, model models.CategorySingleChoice) error
func (CategorySingleChoiceItem) GetOwnerID ¶
func (*CategorySingleChoiceItem) GetParent ¶
func (choice *CategorySingleChoiceItem) GetParent(ctx context.Context, db *gorm.DB) (CategorySingleChoiceGroup, error)
func (*CategorySingleChoiceItem) SetParentId ¶
func (choice *CategorySingleChoiceItem) SetParentId(id uint)
func (*CategorySingleChoiceItem) ToModel ¶
func (choice *CategorySingleChoiceItem) ToModel(context.Context, *gorm.DB) (models.CategorySingleChoice, error)
type HealthEntry ¶
type HealthEntry struct { gorm.Model UserID uint `json:"user_id"` Remarks string `json:"remarks"` HaveBloodPressure bool `json:"have_blood_pressure"` Systole float32 `json:"systole"` Diastole float32 `json:"diastole"` Pulse float32 `json:"pulse"` StartTime time.Time `json:"start_time"` EndTime time.Time `json:"end_time"` MultiChoices []CategoryMultiChoice `gorm:"many2many:entry_multi_choices;" json:"multi_choices"` SingleChoices []CategorySingleChoiceItem `gorm:"many2many:entry_single_choices;" json:"single_choices"` }
func (HealthEntry) GetOwnerID ¶
func (*HealthEntry) SetParentId ¶
func (entry *HealthEntry) SetParentId(id uint)
type User ¶
type User struct { gorm.Model OidcIssuer string OidcSub string Name string FirstName string HealthEntries []HealthEntry Categories []Category `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` }
func (*User) CreateAllowed ¶
func (*User) DeleteAllowed ¶
func (*User) ReadAllowed ¶
func (*User) UpdateAllowed ¶
Click to show internal directories.
Click to hide internal directories.