data

package
v2.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleErr added in v2.0.2

func HandleErr(err error) error

Types

type ActivityDB

type ActivityDB struct {
	ModelExtensions `gorm:"embedded"`
	pkg.Activity    `gorm:"embedded"`
}

func (ActivityDB) TableName

func (ActivityDB) TableName() string

type Db

type Db struct {
	Conn *gorm.DB
}

Db struct

func Init

func Init(user string, pw string, host string, name string) (*Db, error)

Init function return Db

func InitWithDialector

func InitWithDialector(dialector gorm.Dialector) (*Db, error)

func (*Db) DeleteWorkDay

func (d *Db) DeleteWorkDay(day time.Time, userID uint) error

func (*Db) GetActivitiesBetweenStartAndEnd

func (d *Db) GetActivitiesBetweenStartAndEnd(start time.Time, end time.Time, userID uint) ([]ActivityDB, error)

func (*Db) GetActivity

func (d *Db) GetActivity(id uint, userID uint) (*ActivityDB, error)

func (*Db) GetHoliday

func (d *Db) GetHoliday(id uint) (*HolidayDB, error)

func (*Db) GetHolidaysBetweenStartAndEnd

func (d *Db) GetHolidaysBetweenStartAndEnd(start time.Time, end time.Time, userID uint) ([]HolidayDB, error)

func (*Db) GetHolidaysBetweenStartAndEndByType

func (d *Db) GetHolidaysBetweenStartAndEndByType(start time.Time, end time.Time, hType pkg.HolidayType, userID uint) ([]HolidayDB, error)

func (*Db) GetRunningActivityByUserID

func (d *Db) GetRunningActivityByUserID(eID uint) (*ActivityDB, error)

func (*Db) GetTokenByToken

func (d *Db) GetTokenByToken(token string) (*TokenDB, error)

func (*Db) GetTokens

func (d *Db) GetTokens(e UserDB) ([]TokenDB, error)

func (*Db) GetUser

func (d *Db) GetUser(id uint) (*UserDB, error)

func (*Db) GetUserByLogin

func (d *Db) GetUserByLogin(login string) (*UserDB, error)

func (*Db) GetUserByToken

func (d *Db) GetUserByToken(token string) (*UserDB, error)

func (*Db) GetWebhooksByUserID

func (d *Db) GetWebhooksByUserID(userID uint) ([]WebhookDB, error)

func (*Db) GetWorkDay

func (d *Db) GetWorkDay(day time.Time, userID uint) (*WorkDayDB, error)

func (*Db) GetWorkDaysBetweenStartAndEnd

func (d *Db) GetWorkDaysBetweenStartAndEnd(start time.Time, end time.Time, userID uint) ([]WorkDayDB, error)

func (*Db) MigrateActivityDuration

func (d *Db) MigrateActivityDuration() error

func (*Db) SaveActivity

func (d *Db) SaveActivity(a *ActivityDB) error

func (*Db) SaveHoliday

func (d *Db) SaveHoliday(a *HolidayDB) error

func (*Db) SaveToken

func (d *Db) SaveToken(token *TokenDB) error

func (*Db) SaveUser

func (d *Db) SaveUser(user *UserDB) error

func (*Db) SaveWebhook

func (d *Db) SaveWebhook(webhook WebhookDB) (*WebhookDB, error)

func (*Db) SaveWorkDay

func (d *Db) SaveWorkDay(w *WorkDayDB) error

type HolidayDB

type HolidayDB struct {
	ModelExtensions `gorm:"embedded"`
	pkg.Holiday     `gorm:"embedded"`
}

func (HolidayDB) TableName

func (HolidayDB) TableName() string

type ModelExtensions

type ModelExtensions struct {
	CreatedAt time.Time
	UpdatedAt time.Time      `gorm:"index" json:"-"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}

type TokenDB

type TokenDB struct {
	ModelExtensions `gorm:"embedded"`
	pkg.Token       `gorm:"embedded"`
}

func (TokenDB) TableName

func (TokenDB) TableName() string

type UserDB

type UserDB struct {
	ModelExtensions `gorm:"embedded"`
	pkg.User        `gorm:"embedded"`
}

func (UserDB) TableName

func (UserDB) TableName() string

type WebhookDB

type WebhookDB struct {
	ModelExtensions `gorm:"embedded"`
	pkg.Webhook     `gorm:"embedded"`
}

func (WebhookDB) TableName

func (WebhookDB) TableName() string

type WorkDayDB

type WorkDayDB struct {
	ModelExtensions `gorm:"embedded"`
	pkg.WorkDay     `gorm:"embedded"`
}

func (WorkDayDB) TableName

func (WorkDayDB) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL