Documentation ¶
Index ¶
- Variables
- func CloseDB()
- func CountReminderSchedule(db *gorm.DB) (int, error)
- func CountReminderSetting(db *gorm.DB) (int, error)
- func CountUser(db *gorm.DB) (int, error)
- func GetDB() *gorm.DB
- func GetJSTLocation() *time.Location
- func GetReminderSettingsNextNumberForCreate(db *gorm.DB) (uint, error)
- func InitDB()
- func Transact(db *gorm.DB, txFunc func(*gorm.DB) error) (err error)
- func TransactAndReceiveData(db *gorm.DB, txFunc func(*gorm.DB) (interface{}, error)) (data interface{}, err error)
- type ReminderLog
- type ReminderSchedule
- func (rSch *ReminderSchedule) DeleteByReminderSetting(db *gorm.DB, rSet ReminderSetting) error
- func (rSch *ReminderSchedule) GetByID(db *gorm.DB, id uint) error
- func (rSch *ReminderSchedule) GetByReminderSetting(db *gorm.DB, rSet ReminderSetting) error
- func (rSch *ReminderSchedule) UpdateNotifyDateDaysAfterBasis(db *gorm.DB, basisDate time.Time, daysAfter uint) error
- func (rSch *ReminderSchedule) Updates(db *gorm.DB, notifyDate time.Time) error
- type ReminderSetting
- func (rSet *ReminderSetting) CalculateNotifyDate(basisDate time.Time) time.Time
- func (rSet *ReminderSetting) Delete(db *gorm.DB) error
- func (rSet *ReminderSetting) GetByIDAndUserID(db *gorm.DB, id, userID uint) error
- func (rSet *ReminderSetting) GetById(db *gorm.DB, id uint) error
- func (rSet *ReminderSetting) GetByUserIDAndNumber(db *gorm.DB, userID uint, number uint) error
- func (rSet *ReminderSetting) Updates(db *gorm.DB, name, notifyTitle, notifyText string, cycleDays uint) error
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *gorm.DB
Functions ¶
func CountReminderSchedule ¶
CountReminderSchedule 全数カウント
func GetJSTLocation ¶
func GetReminderSettingsNextNumberForCreate ¶
インサート用に次点のnumber値を取得
Types ¶
type ReminderLog ¶
type ReminderSchedule ¶
type ReminderSchedule struct { gorm.Model ReminderSettingID uint `gorm:"not null;" validate:"required,min=1"` NotifyDate time.Time `gorm:"Type:date;not null;" validate:"required,date"` }
ReminderSchedule リマインド予定
func CreateReminderSchedule ¶
func CreateReminderSchedule(db *gorm.DB, reminderSettingID uint, notifyDate time.Time) (*ReminderSchedule, error)
CreateReminderSchedule 新規リマインダー予定作成
func GetReminderSchedulesReachedNotifyDate ¶
func GetReminderSchedulesReachedNotifyDate(db *gorm.DB, targetDate time.Time) ([]ReminderSchedule, error)
GetReminderSchedulesBefore 通知日付に達した全リマインド予定取得
func (*ReminderSchedule) DeleteByReminderSetting ¶
func (rSch *ReminderSchedule) DeleteByReminderSetting(db *gorm.DB, rSet ReminderSetting) error
DeleteByReminderSetting リマインド設定(ユニークキー)で削除
func (*ReminderSchedule) GetByID ¶
func (rSch *ReminderSchedule) GetByID(db *gorm.DB, id uint) error
GetByID PKで取得
func (*ReminderSchedule) GetByReminderSetting ¶
func (rSch *ReminderSchedule) GetByReminderSetting(db *gorm.DB, rSet ReminderSetting) error
GetByReminderSetting リマインド設定(ユニークキー)で検索
func (*ReminderSchedule) UpdateNotifyDateDaysAfterBasis ¶
func (rSch *ReminderSchedule) UpdateNotifyDateDaysAfterBasis(db *gorm.DB, basisDate time.Time, daysAfter uint) error
UpdateNotifyDateDaysAfterBasis 通知日付を指定日時から指定日数後に変更する basisDate 起点日付 *基本的にはtime.Now()を指定する事になる
type ReminderSetting ¶
type ReminderSetting struct { gorm.Model UserID uint `gorm:"not null;" validate:"required,numeric,min=1"` Number uint `gorm:"Type:smallint(5) unsigned;not null; "validate:"required,numeric,min=1"` Name string `gorm:"size:255;not null;" validate:"required,max=100"` NotifyTitle string `gorm:"size:255;not null;" validate:"max=100"` NotifyText string `gorm:"Type:text;not null;" validate:"required,max=1000"` CycleDays uint `gorm:"Type:smallint(5) unsigned;not null;" validate:"required,numeric,min=1,max=365"` //ReminderSchedule ReminderSchedule ReminderLogs []ReminderLog }
func CreateReminderSetting ¶
func CreateReminderSetting(db *gorm.DB, userID uint, name, notifyTitle, notifyText string, cycleDays, number uint) (*ReminderSetting, error)
新規リマインダー作成
func GetReminderSettingsByUser ¶
func GetReminderSettingsByUser(db *gorm.DB, user User) ([]ReminderSetting, error)
ユーザーの全リマインド設定取得
func (*ReminderSetting) CalculateNotifyDate ¶
func (rSet *ReminderSetting) CalculateNotifyDate(basisDate time.Time) time.Time
起点日付+通知間隔日数で日付を算出する
func (*ReminderSetting) GetByIDAndUserID ¶
func (rSet *ReminderSetting) GetByIDAndUserID(db *gorm.DB, id, userID uint) error
GetByIDAndUserID PKとUserIDで取得
func (*ReminderSetting) GetById ¶
func (rSet *ReminderSetting) GetById(db *gorm.DB, id uint) error
IDで検索
func (*ReminderSetting) GetByUserIDAndNumber ¶
GetByUserIDAndNumber UserIDとNumberで検索
type User ¶
type User struct { gorm.Model Email string `gorm:"size:255;not null;unique_index" validate:"required,email"` ReminderSettings []ReminderSetting ReminderLogs []ReminderLog }
func (*User) GetByIDForUpdate ¶
GetByIDForUpdate IDで検索(排他トランザクション)
Click to show internal directories.
Click to hide internal directories.