Documentation ¶
Index ¶
- type Consultant
- type ConsultantCSV
- type ConsultantManager
- type DB
- type Date
- type DateTime
- type Holiday
- type HolidayCSV
- type HolidayManager
- type Project
- type ProjectCSV
- type ProjectManager
- type Rate
- type RateCSV
- type RateManager
- type ReportedRecord
- type ReportedRecordCSV
- type ReportedRecordManager
- func (db *ReportedRecordManager) ReportedRecordAdd(newRecord ReportedRecord) ReportedRecord
- func (db *ReportedRecordManager) ReportedRecordCount() int
- func (db *ReportedRecordManager) ReportedRecordSeed(file string) int
- func (db *ReportedRecordManager) ReportedRecordUpdate(r UpdatedValue) ReportedRecord
- func (db *ReportedRecordManager) ReportedRecordsDelete(id uint64) []ReportedRecord
- func (db *ReportedRecordManager) ReportedRecordsGetAll() []ReportedRecord
- func (db *ReportedRecordManager) ReportedRecordsInMonth(month string) []ReportedRecord
- type UpdatedValue
- type User
- type UserManager
- func (state *UserManager) AddUser(username, password string) *User
- func (state *UserManager) CheckPassword(hashedPassword, password string) bool
- func (state *UserManager) FindUser(username string) *User
- func (state *UserManager) FindUserByUUID(uuid string) *User
- func (state *UserManager) HasUser(username string) bool
- func (state *UserManager) HashPassword(username, password string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consultant ¶
type Consultant struct { ID uint64 `gorm:"primary_key" json:"id"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` DeletedAt *time.Time `json:"-"` Name string `gorm:"not null;unique" json:"name"` }
Consultant struct
type ConsultantCSV ¶
ConsultantCSV csv struct
type ConsultantManager ¶
type ConsultantManager struct {
// contains filtered or unexported fields
}
ConsultantManager struct
func NewConsultantManager ¶
func NewConsultantManager(db *DB) (*ConsultantManager, error)
NewConsultantManager - Create a consultant manager that can be used for retrieving consultants
func (*ConsultantManager) ConsultantCount ¶
func (db *ConsultantManager) ConsultantCount() int
ConsultantCount -
func (*ConsultantManager) ConsultantList ¶
func (db *ConsultantManager) ConsultantList() []Consultant
ConsultantList - return a list of Consultants
func (*ConsultantManager) ConsultantSeed ¶
func (db *ConsultantManager) ConsultantSeed(file string) int
ConsultantSeed - will load data from data file
type Date ¶
Date used for csv marshalling and unmarshalling
func (*Date) MarshalCSV ¶
MarshalCSV Convert the internal date as CSV string
func (*Date) UnmarshalCSV ¶
UnmarshalCSV Convert the CSV string as internal date
type DateTime ¶
DateTime used for csv marshalling and unmarshalling
func (*DateTime) MarshalCSV ¶
MarshalCSV Convert the internal date as CSV string
func (*DateTime) UnmarshalCSV ¶
UnmarshalCSV Convert the CSV string as internal date
type Holiday ¶
type Holiday struct { ID uint64 `gorm:"primary_key" json:"id"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` DeletedAt *time.Time `json:"-"` Date time.Time `gorm:"not null" json:"date"` Description string `gorm:"not null" json:"description"` }
Holiday struct
type HolidayCSV ¶
type HolidayCSV struct { CreatedAt DateTime `csv:"created_at"` Date Date `csv:"date"` Description string `csv:"description"` }
HolidayCSV csv struct
type HolidayManager ¶
type HolidayManager struct {
// contains filtered or unexported fields
}
HolidayManager struct
func NewHolidayManager ¶
func NewHolidayManager(db *DB) (*HolidayManager, error)
NewHolidayManager - Create a Project manager that can be used for retrieving ReportedRecordss
func (*HolidayManager) HolidayCount ¶
func (db *HolidayManager) HolidayCount() int
HolidayCount - return all records of Holidays
func (*HolidayManager) HolidaySeed ¶
func (db *HolidayManager) HolidaySeed(file string) int
HolidaySeed - will load data from data file
func (*HolidayManager) HolidaysGetAll ¶
func (db *HolidayManager) HolidaysGetAll() []Holiday
HolidaysGetAll - return all records of ReportedRecords
type Project ¶
type Project struct { ID uint64 `gorm:"primary_key" json:"id"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` DeletedAt *time.Time `json:"-"` Name string `gorm:"not null" json:"name"` }
Project struct
type ProjectCSV ¶
ProjectCSV csv struct
type ProjectManager ¶
type ProjectManager struct {
// contains filtered or unexported fields
}
ProjectManager struct
func NewProjectManager ¶
func NewProjectManager(db *DB) (*ProjectManager, error)
NewProjectManager - Create a Project manager that can be used for retrieving ReportedRecordss
func (*ProjectManager) ProjectCount ¶
func (db *ProjectManager) ProjectCount() int
ProjectCount - return all records of Rates
func (*ProjectManager) ProjectSeed ¶
func (db *ProjectManager) ProjectSeed(file string) int
ProjectSeed - will load data from data file
func (*ProjectManager) ProjectsGetAll ¶
func (db *ProjectManager) ProjectsGetAll() []Project
ProjectsGetAll - return all records of ReportedRecords
type Rate ¶
type Rate struct { ID uint64 `gorm:"primary_key" json:"id"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` DeletedAt *time.Time `json:"-"` Name string `gorm:"not null" json:"name"` }
Rate struct
type RateManager ¶
type RateManager struct {
// contains filtered or unexported fields
}
RateManager struct
func NewRateManager ¶
func NewRateManager(db *DB) (*RateManager, error)
NewRateManager - Create a Rate manager that can be used for retrieving ReportedRecordss
func (*RateManager) RateCount ¶
func (db *RateManager) RateCount() int
RateCount - return all records of Rates
func (*RateManager) RateSeed ¶
func (db *RateManager) RateSeed(file string) int
RateSeed - will load data from data file
func (*RateManager) RatesGetAll ¶
func (db *RateManager) RatesGetAll() []Rate
RatesGetAll - return all records of Rates
type ReportedRecord ¶
type ReportedRecord struct { ID uint64 `gorm:"primary_key" json:"id"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` DeletedAt *time.Time `json:"-"` Date time.Time `gorm:"not null" json:"date"` Hours float64 `gorm:"not null" json:"hours"` Project string `gorm:"not null" json:"project"` Description string `gorm:"not null" json:"description"` Rate string `gorm:"not null" json:"rate"` Consultant string `gorm:"not null" json:"consultant"` }
ReportedRecord struct
type ReportedRecordCSV ¶
type ReportedRecordCSV struct { CreatedAt DateTime `csv:"created_at"` Date Date `csv:"date"` Hours float64 `csv:"hours"` Project string `csv:"project"` Description string `csv:"description"` Rate string `csv:"rate"` Consultant string `csv:"consultant"` }
ReportedRecordCSV csv struct
type ReportedRecordManager ¶
type ReportedRecordManager struct {
// contains filtered or unexported fields
}
ReportedRecordManager struct
func NewReportedRecordManager ¶
func NewReportedRecordManager(db *DB) (*ReportedRecordManager, error)
NewReportedRecordManager - Create a ReportedRecords manager that can be used for retrieving ReportedRecordss
func (*ReportedRecordManager) ReportedRecordAdd ¶
func (db *ReportedRecordManager) ReportedRecordAdd(newRecord ReportedRecord) ReportedRecord
ReportedRecordAdd -
func (*ReportedRecordManager) ReportedRecordCount ¶
func (db *ReportedRecordManager) ReportedRecordCount() int
ReportedRecordCount -
func (*ReportedRecordManager) ReportedRecordSeed ¶
func (db *ReportedRecordManager) ReportedRecordSeed(file string) int
ReportedRecordSeed - will load data from data file
func (*ReportedRecordManager) ReportedRecordUpdate ¶
func (db *ReportedRecordManager) ReportedRecordUpdate(r UpdatedValue) ReportedRecord
ReportedRecordUpdate -
func (*ReportedRecordManager) ReportedRecordsDelete ¶
func (db *ReportedRecordManager) ReportedRecordsDelete(id uint64) []ReportedRecord
ReportedRecordsDelete - return all records of ReportedRecords
func (*ReportedRecordManager) ReportedRecordsGetAll ¶
func (db *ReportedRecordManager) ReportedRecordsGetAll() []ReportedRecord
ReportedRecordsGetAll - return all records of ReportedRecords
func (*ReportedRecordManager) ReportedRecordsInMonth ¶
func (db *ReportedRecordManager) ReportedRecordsInMonth(month string) []ReportedRecord
ReportedRecordsInMonth - return all records of ReportedRecords
type UpdatedValue ¶
UpdatedValue used to pass updated ReportedRecord value type and relevant ID
type User ¶
type User struct { ID uint64 `gorm:"primary_key" json:"id"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` DeletedAt *time.Time `json:"-"` Username string `gorm:"not null;unique" json:"username"` Password string `gorm:"not null" json:"-"` UUID string `gorm:"not null;unique" json:"uuid"` }
User struct
type UserManager ¶
type UserManager struct {
// contains filtered or unexported fields
}
UserManager struct
func NewUserManager ¶
func NewUserManager(db *DB) (*UserManager, error)
NewUserManager - Create a new *UserManager that can be used for managing users.
func (*UserManager) AddUser ¶
func (state *UserManager) AddUser(username, password string) *User
AddUser - Creates a user and hashes the password
func (*UserManager) CheckPassword ¶
func (state *UserManager) CheckPassword(hashedPassword, password string) bool
CheckPassword - compare a hashed password with a possible plaintext equivalent
func (*UserManager) FindUserByUUID ¶
func (state *UserManager) FindUserByUUID(uuid string) *User
FindUserByUUID -
func (*UserManager) HasUser ¶
func (state *UserManager) HasUser(username string) bool
HasUser - Check if the given username exists.
func (*UserManager) HashPassword ¶
func (state *UserManager) HashPassword(username, password string) string
HashPassword - Hash the password (takes a username as well, it can be used for salting).