Documentation
¶
Overview ¶
Package dbmodel contains the binding types used by GORM to map to the database tables and rows.
Index ¶
Constants ¶
const ( EntryColumnID = "id" EntryColumnStart = "start" EntryColumnEnd = "end" )
Column names for Entry.
const ( EntryFTS5ColumnRowID = "entries_idx.rowid" EntryFTS5ColumnName = "entries_idx.name" )
Column names for EntryFTS5.
const (
EntryFieldEnd = "End"
)
Field names for Entry.
Variables ¶
var (
CommonFieldsColumnID = "id"
)
Fields names for CommonFields.
Functions ¶
This section is empty.
Types ¶
type CommonFields ¶
type CommonFields struct { // ID is a unique identifier for this entry. The same ID will never be used // twice for a given database. ID uint `gorm:"primaryKey;autoIncrement;type:INTEGER PRIMARY KEY AUTOINCREMENT"` // CreatedAt stores when the database object was added to the database. // // It is automatically set by GORM due to its naming convention. CreatedAt time.Time // UpdatedAt stores when the database object was added to the database or // when it was last updated. // // It is automatically set by GORM due to its naming convention. UpdatedAt time.Time }
CommonFields contains fields used by multiple other models.
type Entry ¶
type Entry struct { CommonFields // Name of the entry. Name string `gorm:"not null;default:''"` // Start time of the entry. Start time.Time `gorm:"not null;default:CURRENT_TIMESTAMP;index"` // End time of the entry, or nil if the entry is still active. End *time.Time `gorm:"index"` }
Entry is a time tracked entry stored in the database.
type EntryFTS5 ¶
type EntryFTS5 struct { RowID uint `gorm:"primaryKey;column:rowid"` Name string `gorm:"not null;default:''"` }
EntryFTS5 is used for free-text searching entries.
type Migration ¶
type Migration struct { CommonFields Version MigrationVersion }
Migration holds the latest migration revision identifier. At most one row of this object is expected to be in the database at any given time.
type MigrationVersion ¶
type MigrationVersion int
MigrationVersion is an enumeration stating how outdated the database schema is.
const ( // MigrationUnknown means that Dinkur was unable to evaluate the database's // migration status. Perhaps due to an error. MigrationUnknown MigrationVersion = -1 // MigrationNeverApplied means the database has never been migrated before. // In other words, it's a brand new database. MigrationNeverApplied MigrationVersion = 0 // MigrationUpToDate means the database does not need any further migrations // applied. MigrationUpToDate MigrationVersion = LatestMigrationVersion )
const LatestMigrationVersion MigrationVersion = 8
LatestMigrationVersion is an integer revision identifier for what migration was last applied to the database. This is stored in the database to quickly figure out if new migrations needs to be applied.
func (MigrationVersion) String ¶
func (s MigrationVersion) String() string