Documentation
¶
Index ¶
- Constants
- Variables
- func OpenDB(dsn string, maxConnections int, logging bool) (*gorm.DB, error)
- func Placeholders(values []interface{}) string
- func ReplaceToTestDBURL(t *testing.T, dbURL string) string
- type EventLogEmail
- type EventLogEmailService
- func (s *EventLogEmailService) Create(e *EventLogEmail) error
- func (s *EventLogEmailService) FindStatDailyNotificationEventByDate(date time.Time) ([]*StatDailyNotificationEvent, error)
- func (s *EventLogEmailService) FindStatDailyNotificationEventUUCountByDate(date time.Time) ([]*StatDailyNotificationEvent, error)
- func (s *EventLogEmailService) FindStatDailyUserNotificationEvent(date time.Time) ([]*StatDailyUserNotificationEvent, error)
- func (s *EventLogEmailService) FindStatsNewLessonNotifierByDate(date time.Time) ([]*StatNewLessonNotifier, error)
- func (s *EventLogEmailService) FindStatsNewLessonNotifierUUCountByDate(date time.Time) ([]*StatNewLessonNotifier, error)
- type FollowingTeacher
- type FollowingTeacherService
- type LessonStatus
- type MCountry
- type NotificationTimeSpan
- type NotificationTimeSpanList
- type NotificationTimeSpanService
- type StatDailyNotificationEvent
- type StatDailyNotificationEventService
- type StatDailyUserNotificationEvent
- type StatDailyUserNotificationEventService
- type StatNewLessonNotifier
- type StatNewLessonNotifierService
- type StatNotifier
- type StatNotifierService
- type Teacher
- type TeacherService
- func (s *TeacherService) CreateOrUpdate(t *Teacher) error
- func (s *TeacherService) FindByFetchErrorCountGt(count uint32) ([]*Teacher, error)
- func (s *TeacherService) FindByPK(id uint32) (*Teacher, error)
- func (s *TeacherService) IncrementFetchErrorCount(id uint32, value int) error
- func (s *TeacherService) ResetFetchErrorCount(id uint32) error
- type TestHelper
- func (h *TestHelper) CreateRandomTeacher(t *testing.T) *Teacher
- func (h *TestHelper) CreateRandomUser(t *testing.T) *User
- func (h *TestHelper) CreateTeacher(t *testing.T, id uint32, name string) *Teacher
- func (h *TestHelper) CreateUser(t *testing.T, name, email string) *User
- func (h *TestHelper) DB(t *testing.T) *gorm.DB
- func (h *TestHelper) GetDBName(dbURL string) string
- func (h *TestHelper) LoadAllTables(t *testing.T, db *gorm.DB) []string
- func (h *TestHelper) TruncateAllTables(t *testing.T)
- type User
- type UserService
- func (s *UserService) Create(name, email string) (*User, error)
- func (s *UserService) FindAllFollowedTeacherAtIsNull(createdAt time.Time) ([]*User, error)
- func (s *UserService) FindByPK(id uint32) (*User, error)
- func (s *UserService) FindLoggedInUser(token string) (*User, error)
- func (s *UserService) TableName() string
- func (s *UserService) UpdateOpenNotificationAt(userID uint32, t time.Time) error
Constants ¶
View Source
const DefaultMPlanID = uint8(1)
View Source
const MaxFollowTeacherCount = 20
Variables ¶
View Source
var LessonStatuses = goenum.EnumerateStruct(&LessonStatus{
Finished: 1,
Reserved: 2,
Available: 3,
Cancelled: 4,
})
Functions ¶
func Placeholders ¶
func Placeholders(values []interface{}) string
Types ¶
type EventLogEmail ¶
type EventLogEmail struct { Datetime time.Time Event string EmailType string UserID uint32 UserAgent string TeacherIDs string URL string }
func (*EventLogEmail) TableName ¶
func (*EventLogEmail) TableName() string
type EventLogEmailService ¶
type EventLogEmailService struct {
// contains filtered or unexported fields
}
func NewEventLogEmailService ¶
func NewEventLogEmailService(db *gorm.DB) *EventLogEmailService
func (*EventLogEmailService) Create ¶
func (s *EventLogEmailService) Create(e *EventLogEmail) error
func (*EventLogEmailService) FindStatDailyNotificationEventByDate ¶
func (s *EventLogEmailService) FindStatDailyNotificationEventByDate(date time.Time) ([]*StatDailyNotificationEvent, error)
func (*EventLogEmailService) FindStatDailyNotificationEventUUCountByDate ¶
func (s *EventLogEmailService) FindStatDailyNotificationEventUUCountByDate(date time.Time) ([]*StatDailyNotificationEvent, error)
func (*EventLogEmailService) FindStatDailyUserNotificationEvent ¶
func (s *EventLogEmailService) FindStatDailyUserNotificationEvent(date time.Time) ([]*StatDailyUserNotificationEvent, error)
func (*EventLogEmailService) FindStatsNewLessonNotifierByDate ¶
func (s *EventLogEmailService) FindStatsNewLessonNotifierByDate(date time.Time) ([]*StatNewLessonNotifier, error)
func (*EventLogEmailService) FindStatsNewLessonNotifierUUCountByDate ¶
func (s *EventLogEmailService) FindStatsNewLessonNotifierUUCountByDate(date time.Time) ([]*StatNewLessonNotifier, error)
type FollowingTeacher ¶
type FollowingTeacher struct { UserID uint32 `gorm:"primary_key"` TeacherID uint32 `gorm:"primary_key"` CreatedAt time.Time UpdatedAt time.Time }
func (*FollowingTeacher) TableName ¶
func (*FollowingTeacher) TableName() string
type FollowingTeacherService ¶
type FollowingTeacherService struct {
// contains filtered or unexported fields
}
func NewFollowingTeacherService ¶
func NewFollowingTeacherService(db *gorm.DB) *FollowingTeacherService
func (*FollowingTeacherService) FindTeacherIDs ¶
func (s *FollowingTeacherService) FindTeacherIDs() ([]uint32, error)
func (*FollowingTeacherService) TableName ¶
func (s *FollowingTeacherService) TableName() string
type LessonStatus ¶
type MCountry ¶
type NotificationTimeSpan ¶
type NotificationTimeSpan struct { UserID uint32 Number uint8 FromTime string ToTime string CreatedAt time.Time // contains filtered or unexported fields }
func (*NotificationTimeSpan) ParseTime ¶
func (s *NotificationTimeSpan) ParseTime() error
func (*NotificationTimeSpan) TableName ¶
func (*NotificationTimeSpan) TableName() string
type NotificationTimeSpanList ¶
type NotificationTimeSpanList []*NotificationTimeSpan
type NotificationTimeSpanService ¶
type NotificationTimeSpanService struct {
// contains filtered or unexported fields
}
func NewNotificationTimeSpanService ¶
func NewNotificationTimeSpanService(db *gorm.DB) *NotificationTimeSpanService
func (*NotificationTimeSpanService) FindByUserID ¶
func (s *NotificationTimeSpanService) FindByUserID( ctx context.Context, userID uint32, ) ([]*NotificationTimeSpan, error)
FindByUserID is used from SendNotification on notifier.go
func (*NotificationTimeSpanService) UpdateAll ¶
func (s *NotificationTimeSpanService) UpdateAll(userID uint32, timeSpans []*NotificationTimeSpan) error
UpdateAll is used from TestNotifier_SendNotification
type StatDailyNotificationEvent ¶
func (*StatDailyNotificationEvent) TableName ¶
func (*StatDailyNotificationEvent) TableName() string
type StatDailyNotificationEventService ¶
type StatDailyNotificationEventService struct {
// contains filtered or unexported fields
}
func NewStatDailyNotificationEventService ¶
func NewStatDailyNotificationEventService(db *gorm.DB) *StatDailyNotificationEventService
func (*StatDailyNotificationEventService) CreateOrUpdate ¶
func (s *StatDailyNotificationEventService) CreateOrUpdate(v *StatDailyNotificationEvent) error
func (*StatDailyNotificationEventService) FindAllByDate ¶
func (s *StatDailyNotificationEventService) FindAllByDate(date time.Time) ([]*StatDailyNotificationEvent, error)
type StatDailyUserNotificationEvent ¶
type StatDailyUserNotificationEvent struct { Date time.Time UserID uint32 Event string Count uint32 }
func (*StatDailyUserNotificationEvent) TableName ¶
func (*StatDailyUserNotificationEvent) TableName() string
type StatDailyUserNotificationEventService ¶
type StatDailyUserNotificationEventService struct {
// contains filtered or unexported fields
}
func NewStatDailyUserNotificationEventService ¶
func NewStatDailyUserNotificationEventService(db *gorm.DB) *StatDailyUserNotificationEventService
func (*StatDailyUserNotificationEventService) CreateOrUpdate ¶
func (s *StatDailyUserNotificationEventService) CreateOrUpdate(date time.Time) error
func (*StatDailyUserNotificationEventService) FindAllByDate ¶
func (s *StatDailyUserNotificationEventService) FindAllByDate(date time.Time) ([]*StatDailyUserNotificationEvent, error)
type StatNewLessonNotifier ¶
func (*StatNewLessonNotifier) TableName ¶
func (*StatNewLessonNotifier) TableName() string
type StatNewLessonNotifierService ¶
type StatNewLessonNotifierService struct {
// contains filtered or unexported fields
}
func NewStatsNewLessonNotifierService ¶
func NewStatsNewLessonNotifierService(db *gorm.DB) *StatNewLessonNotifierService
func (*StatNewLessonNotifierService) CreateOrUpdate ¶
func (s *StatNewLessonNotifierService) CreateOrUpdate(v *StatNewLessonNotifier) error
type StatNotifier ¶
type StatNotifier struct { Datetime time.Time Interval uint8 Elapsed uint32 UserCount uint32 FollowedTeacherCount uint32 }
func (*StatNotifier) TableName ¶
func (*StatNotifier) TableName() string
type StatNotifierService ¶
type StatNotifierService struct {
// contains filtered or unexported fields
}
func NewStatNotifierService ¶
func NewStatNotifierService(db *gorm.DB) *StatNotifierService
func (*StatNotifierService) CreateOrUpdate ¶
func (s *StatNotifierService) CreateOrUpdate(v *StatNotifier) error
type Teacher ¶
type Teacher struct { ID uint32 Name string CountryID uint16 Gender string Birthday time.Time YearsOfExperience uint8 FavoriteCount uint32 ReviewCount uint32 Rating float32 LastLessonAt time.Time FetchErrorCount uint8 CreatedAt time.Time UpdatedAt time.Time }
func NewTeacher ¶
func NewTeachersFromIDsOrURL ¶
func (*Teacher) IsJapanese ¶
type TeacherService ¶
type TeacherService struct {
// contains filtered or unexported fields
}
func NewTeacherService ¶
func NewTeacherService(db *gorm.DB) *TeacherService
func (*TeacherService) CreateOrUpdate ¶
func (s *TeacherService) CreateOrUpdate(t *Teacher) error
func (*TeacherService) FindByFetchErrorCountGt ¶
func (s *TeacherService) FindByFetchErrorCountGt(count uint32) ([]*Teacher, error)
func (*TeacherService) IncrementFetchErrorCount ¶
func (s *TeacherService) IncrementFetchErrorCount(id uint32, value int) error
func (*TeacherService) ResetFetchErrorCount ¶
func (s *TeacherService) ResetFetchErrorCount(id uint32) error
type TestHelper ¶
type TestHelper struct {
// contains filtered or unexported fields
}
func NewTestHelper ¶
func NewTestHelper() *TestHelper
func (*TestHelper) CreateRandomTeacher ¶
func (h *TestHelper) CreateRandomTeacher(t *testing.T) *Teacher
func (*TestHelper) CreateRandomUser ¶
func (h *TestHelper) CreateRandomUser(t *testing.T) *User
func (*TestHelper) CreateTeacher ¶
func (*TestHelper) CreateUser ¶
func (h *TestHelper) CreateUser(t *testing.T, name, email string) *User
func (*TestHelper) GetDBName ¶
func (h *TestHelper) GetDBName(dbURL string) string
func (*TestHelper) LoadAllTables ¶
func (*TestHelper) TruncateAllTables ¶
func (h *TestHelper) TruncateAllTables(t *testing.T)
type User ¶
type User struct { ID uint32 `gorm:"primary_key;AUTO_INCREMENT"` Name string Email string EmailVerified bool PlanID uint8 FollowedTeacherAt sql.NullTime OpenNotificationAt sql.NullTime CreatedAt time.Time UpdatedAt time.Time }
func (*User) IsFollowedTeacher ¶
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(db *gorm.DB) *UserService
func (*UserService) FindAllFollowedTeacherAtIsNull ¶
func (s *UserService) FindAllFollowedTeacherAtIsNull(createdAt time.Time) ([]*User, error)
FindAllFollowedTeacherAtIsNull returns an empty slice if no users found
func (*UserService) FindLoggedInUser ¶
func (s *UserService) FindLoggedInUser(token string) (*User, error)
func (*UserService) TableName ¶
func (s *UserService) TableName() string
func (*UserService) UpdateOpenNotificationAt ¶
func (s *UserService) UpdateOpenNotificationAt(userID uint32, t time.Time) error
Click to show internal directories.
Click to hide internal directories.