Documentation
¶
Index ¶
- Constants
- Variables
- func DBInit(DbType string, DbPath string)
- func DBPreload()
- func GetCustomerByName(customerName string, customer *Customer) error
- func GetProjectByID(projectID uint, project *Project) error
- func GetProjectByName(customerName string, projectName string, project *Project) error
- type Customer
- type Entry
- func (e Entry) GetCustomerName() string
- func (e Entry) GetDesc() string
- func (e Entry) GetDuration() int64
- func (e Entry) GetDurationString() string
- func (e Entry) GetID() uint
- func (e Entry) GetName() string
- func (e Entry) GetProjectName() string
- func (e Entry) GetSDate() int64
- func (e Entry) GetSDateString() string
- func (e Entry) MarshalJSON() ([]byte, error)
- type Project
- func (p Project) GetCustomerName() string
- func (p Project) GetCustomerRate() uint
- func (p Project) GetEstimate() int64
- func (p Project) GetEstimateString() string
- func (p Project) GetFinished() bool
- func (p Project) GetID() uint
- func (p Project) GetName() string
- func (p Project) GetWorkLogged() int64
- func (p Project) GetWorkLoggedString() string
- func (p Project) MarshalJSON() ([]byte, error)
- type Tag
Constants ¶
const ShortForm = "02/01/2006"
Variables ¶
var DBc *gorm.DB
DBc connection to our local DB
Functions ¶
func DBPreload ¶
func DBPreload()
DBPreload will load db with preload data TODO: Make sure we load only data which is needed when it's needed.
func GetCustomerByName ¶
GetCustomerByName return customer if exists
func GetProjectByID ¶
GetProjectByID searchs for a project by it's ID and customer's ID to whitch it belongs
Types ¶
type Customer ¶
type Customer struct {
gorm.Model
Name string `gorm:"unique;not null"`
Rate uint
Projects []Project `gorm:"foreignkey:CustomerID"`
ContactName string
ContactEmail string
}
Customer definitions with it's getters
func (Customer) GetContactEmail ¶
GetContactEmail getter for customer email
func (Customer) GetContactName ¶
GetContactName getter for customer contact
type Entry ¶
type Entry struct {
gorm.Model
Name string
Duration int64
StartDate int64
EndDate int64
Desc string
Billable bool
ProjectID uint
Tags []*Tag `gorm:"many2many:entry_tags;" json:"-"`
}
Entry definitions with it's Byters
func (Entry) GetCustomerName ¶
GetCustomerName for instance of a project
func (Entry) GetDurationString ¶
GetDurationString gets duretion converted to string for entry
func (Entry) GetProjectName ¶
GetProjectName for instance of a project
func (Entry) GetSDateString ¶
func (Entry) MarshalJSON ¶
type Project ¶
type Project struct {
gorm.Model
Name string
Estimate int64
Finished bool `gorm:"default:false"`
CustomerID uint `json:"-"`
Entries []Entry `gorm:"foreignkey:ProjectID"`
}
Project definitions with it's getters
func (Project) GetCustomerName ¶
GetCustomerName for instance of a project
func (Project) GetCustomerRate ¶
GetCustomerRate for instance of a project
func (Project) GetEstimate ¶
GetEstimate getter for project Planned hours
func (Project) GetEstimateString ¶
GetDurationString gets duretion converted to string for entry