Documentation ¶
Overview ¶
Package xo_wxstat contains generated code for schema 'wxstat.sqlite3'.
Index ¶
- Variables
- func Errorf(s string, v ...interface{})
- func Logf(s string, v ...interface{})
- func SetErrorLogger(logger interface{})
- func SetLogger(logger interface{})
- type ActivityLog
- func (al *ActivityLog) Delete(ctx context.Context, db DB) error
- func (al *ActivityLog) Deleted() bool
- func (al *ActivityLog) Exists() bool
- func (al *ActivityLog) Insert(ctx context.Context, db DB) error
- func (al *ActivityLog) Save(ctx context.Context, db DB) error
- func (al *ActivityLog) Update(ctx context.Context, db DB) error
- func (al *ActivityLog) Upsert(ctx context.Context, db DB) error
- type ActivityType
- func (at *ActivityType) Delete(ctx context.Context, db DB) error
- func (at *ActivityType) Deleted() bool
- func (at *ActivityType) Exists() bool
- func (at *ActivityType) Insert(ctx context.Context, db DB) error
- func (at *ActivityType) Save(ctx context.Context, db DB) error
- func (at *ActivityType) Update(ctx context.Context, db DB) error
- func (at *ActivityType) Upsert(ctx context.Context, db DB) error
- type DB
- type ErrInsertFailed
- type ErrInvalidTime
- type ErrUpdateFailed
- type ErrUpsertFailed
- type Error
- type GetGroupID
- type GetGroupSettings
- type Time
- type User
- func (u *User) Delete(ctx context.Context, db DB) error
- func (u *User) Deleted() bool
- func (u *User) Exists() bool
- func (u *User) Insert(ctx context.Context, db DB) error
- func (u *User) Save(ctx context.Context, db DB) error
- func (u *User) Update(ctx context.Context, db DB) error
- func (u *User) Upsert(ctx context.Context, db DB) error
- type UserStat
- type WxGroup
- func (wg *WxGroup) Delete(ctx context.Context, db DB) error
- func (wg *WxGroup) Deleted() bool
- func (wg *WxGroup) Exists() bool
- func (wg *WxGroup) Insert(ctx context.Context, db DB) error
- func (wg *WxGroup) Save(ctx context.Context, db DB) error
- func (wg *WxGroup) Update(ctx context.Context, db DB) error
- func (wg *WxGroup) Upsert(ctx context.Context, db DB) error
Constants ¶
This section is empty.
Variables ¶
var TimestampFormats = []string{
"2006-01-02 15:04:05.999999999-07:00",
"2006-01-02T15:04:05.999999999-07:00",
"2006-01-02 15:04:05.999999999",
"2006-01-02T15:04:05.999999999",
"2006-01-02 15:04:05",
"2006-01-02T15:04:05",
"2006-01-02 15:04",
"2006-01-02T15:04",
"2006-01-02",
}
TimestampFormats are the timestamp formats used by SQLite3 database drivers to store a time.Time in SQLite3.
The first format in the slice will be used when saving time values into the database. When parsing a string from a timestamp or datetime column, the formats are tried in order.
Functions ¶
func Errorf ¶
func Errorf(s string, v ...interface{})
Errorf logs an error message using the package error logger.
func SetErrorLogger ¶
func SetErrorLogger(logger interface{})
SetErrorLogger sets the package error logger. Valid logger types:
io.Writer func(string, ...interface{}) (int, error) // fmt.Printf func(string, ...interface{}) // log.Printf
Types ¶
type ActivityLog ¶
type ActivityLog struct { ActivityLogID int `json:"activity_log_id"` // activity_log_id UserID int `json:"user_id"` // user_id GroupID int `json:"group_id"` // group_id ActivityTypeID int `json:"activity_type_id"` // activity_type_id ActivityDate Time `json:"activity_date"` // activity_date Stat int `json:"stat"` // stat // contains filtered or unexported fields }
ActivityLog represents a row from 'activity_log'.
func ActivityLogByActivityLogID ¶
func ActivityLogByActivityLogID(ctx context.Context, db DB, activityLogID int) (*ActivityLog, error)
ActivityLogByActivityLogID retrieves a row from 'activity_log' as a ActivityLog.
Generated from index 'activity_log_activity_log_id_pkey'.
func (*ActivityLog) Delete ¶
func (al *ActivityLog) Delete(ctx context.Context, db DB) error
Delete deletes the ActivityLog from the database.
func (*ActivityLog) Deleted ¶
func (al *ActivityLog) Deleted() bool
Deleted returns true when the ActivityLog has been marked for deletion from the database.
func (*ActivityLog) Exists ¶
func (al *ActivityLog) Exists() bool
Exists returns true when the ActivityLog exists in the database.
func (*ActivityLog) Insert ¶
func (al *ActivityLog) Insert(ctx context.Context, db DB) error
Insert inserts the ActivityLog to the database.
func (*ActivityLog) Save ¶
func (al *ActivityLog) Save(ctx context.Context, db DB) error
Save saves the ActivityLog to the database.
type ActivityType ¶
type ActivityType struct { ActivityTypeID int `json:"activity_type_id"` // activity_type_id Name string `json:"name"` // name Scale int `json:"scale"` // scale Comment sql.NullString `json:"comment"` // comment // contains filtered or unexported fields }
ActivityType represents a row from 'activity_type'.
func ActivityTypeByActivityTypeID ¶
func ActivityTypeByActivityTypeID(ctx context.Context, db DB, activityTypeID int) (*ActivityType, error)
ActivityTypeByActivityTypeID retrieves a row from 'activity_type' as a ActivityType.
Generated from index 'activity_type_activity_type_id_pkey'.
func (*ActivityType) Delete ¶
func (at *ActivityType) Delete(ctx context.Context, db DB) error
Delete deletes the ActivityType from the database.
func (*ActivityType) Deleted ¶
func (at *ActivityType) Deleted() bool
Deleted returns true when the ActivityType has been marked for deletion from the database.
func (*ActivityType) Exists ¶
func (at *ActivityType) Exists() bool
Exists returns true when the ActivityType exists in the database.
func (*ActivityType) Insert ¶
func (at *ActivityType) Insert(ctx context.Context, db DB) error
Insert inserts the ActivityType to the database.
func (*ActivityType) Save ¶
func (at *ActivityType) Save(ctx context.Context, db DB) error
Save saves the ActivityType to the database.
type DB ¶
type DB interface { ExecContext(context.Context, string, ...interface{}) (sql.Result, error) QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) QueryRowContext(context.Context, string, ...interface{}) *sql.Row }
DB is the common interface for database operations that can be used with types from schema 'wxstat.sqlite3'.
This works with both database/sql.DB and database/sql.Tx.
type ErrInsertFailed ¶
type ErrInsertFailed struct {
Err error
}
ErrInsertFailed is the insert failed error.
func (*ErrInsertFailed) Error ¶
func (err *ErrInsertFailed) Error() string
Error satisfies the error interface.
func (*ErrInsertFailed) Unwrap ¶
func (err *ErrInsertFailed) Unwrap() error
Unwrap satisfies the unwrap interface.
type ErrInvalidTime ¶
type ErrInvalidTime string
ErrInvalidTime is the invalid Time error.
func (ErrInvalidTime) Error ¶
func (err ErrInvalidTime) Error() string
Error satisfies the error interface.
type ErrUpdateFailed ¶
type ErrUpdateFailed struct {
Err error
}
ErrUpdateFailed is the update failed error.
func (*ErrUpdateFailed) Error ¶
func (err *ErrUpdateFailed) Error() string
Error satisfies the error interface.
func (*ErrUpdateFailed) Unwrap ¶
func (err *ErrUpdateFailed) Unwrap() error
Unwrap satisfies the unwrap interface.
type ErrUpsertFailed ¶
type ErrUpsertFailed struct {
Err error
}
ErrUpsertFailed is the upsert failed error.
func (*ErrUpsertFailed) Error ¶
func (err *ErrUpsertFailed) Error() string
Error satisfies the error interface.
func (*ErrUpsertFailed) Unwrap ¶
func (err *ErrUpsertFailed) Unwrap() error
Unwrap satisfies the unwrap interface.
type Error ¶
type Error string
Error is an error.
const ( // ErrAlreadyExists is the already exists error. ErrAlreadyExists Error = "already exists" // ErrDoesNotExist is the does not exist error. ErrDoesNotExist Error = "does not exist" // ErrMarkedForDeletion is the marked for deletion error. ErrMarkedForDeletion Error = "marked for deletion" )
Error values.
type GetGroupID ¶
type GetGroupID struct {
GroupID int `json:"group_id"` // group_id
}
Custom defined search query GetGroupID
func GetGroupIDsByGroupName ¶
GetGroupIDsByGroupName runs a custom query, returning results as GetGroupID.
type GetGroupSettings ¶
type GetGroupSettings struct { ActivePeriod int `json:"active_period"` // active_period QuietPeriod int `json:"quiet_period"` // quiet_period ActiveNum int `json:"active_num"` // active_num QuietNum int `json:"quiet_num"` // quiet_num }
Custom defined search query GetGroupSettings
func GetGroupSettingsByGroupID ¶
func GetGroupSettingsByGroupID(ctx context.Context, db DB, GroupID string) ([]*GetGroupSettings, error)
GetGroupSettingsByGroupID runs a custom query, returning results as GetGroupSettings.
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
Time is a SQLite3 Time that scans for the various timestamps values used by SQLite3 database drivers to store time.Time values.
type User ¶
type User struct { UserID int `json:"user_id"` // user_id Name string `json:"name"` // name // contains filtered or unexported fields }
User represents a row from 'user'.
func UserByName ¶
UserByName retrieves a row from 'user' as a User.
Generated from index 'idx_user_name'.
func UserByUserID ¶
UserByUserID retrieves a row from 'user' as a User.
Generated from index 'user_user_id_pkey'.
func (*User) Deleted ¶
Deleted returns true when the User has been marked for deletion from the database.
type UserStat ¶
type UserStat struct { UserID int `json:"user_id"` // user_id GroupID int `json:"group_id"` // group_id WordCount int `json:"word_count"` // word_count CorrectionCount int `json:"correction_count"` // correction_count MemeCount int `json:"meme_count"` // meme_count }
UserStat represents a row from 'user_stat_'.
type WxGroup ¶
type WxGroup struct { GroupID int `json:"group_id"` // group_id Name string `json:"name"` // name Comment sql.NullString `json:"comment"` // comment ActivePeriod int `json:"active_period"` // active_period QuietPeriod int `json:"quiet_period"` // quiet_period ActiveNum int `json:"active_num"` // active_num QuietNum int `json:"quiet_num"` // quiet_num // contains filtered or unexported fields }
WxGroup represents a row from 'wx_group'.
func WxGroupByGroupID ¶
WxGroupByGroupID retrieves a row from 'wx_group' as a WxGroup.
Generated from index 'wx_group_group_id_pkey'.
func WxGroupByName ¶
WxGroupByName retrieves a row from 'wx_group' as a WxGroup.
Generated from index 'idx_wx_group_name'.
func (*WxGroup) Deleted ¶
Deleted returns true when the WxGroup has been marked for deletion from the database.