xo_wxstat

package
v0.0.0-...-de2ba7e Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package xo_wxstat contains generated code for schema 'wxstat.sqlite3'.

Index

Constants

This section is empty.

Variables

View Source
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 Logf

func Logf(s string, v ...interface{})

Logf logs a message using the package 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

func SetLogger

func SetLogger(logger interface{})

SetLogger sets the package 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.

func (*ActivityLog) Update

func (al *ActivityLog) Update(ctx context.Context, db DB) error

Update updates a ActivityLog in the database.

func (*ActivityLog) Upsert

func (al *ActivityLog) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for ActivityLog.

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.

func (*ActivityType) Update

func (at *ActivityType) Update(ctx context.Context, db DB) error

Update updates a ActivityType in the database.

func (*ActivityType) Upsert

func (at *ActivityType) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for ActivityType.

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.

func (Error) Error

func (err Error) Error() string

Error satisfies the error interface.

type GetGroupID

type GetGroupID struct {
	GroupID int `json:"group_id"` // group_id
}

Custom defined search query GetGroupID

func GetGroupIDsByGroupName

func GetGroupIDsByGroupName(ctx context.Context, db DB, GroupName string) ([]*GetGroupID, error)

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.

func NewTime

func NewTime(t time.Time) Time

NewTime creates a time.

func (Time) Format

func (t Time) Format(layout string) string

Format formats the time.

func (*Time) Parse

func (t *Time) Parse(s string) error

Parse attempts to Parse string s to t.

func (*Time) Scan

func (t *Time) Scan(v interface{}) error

Scan satisfies the sql.Scanner interface.

func (Time) String

func (t Time) String() string

String satisfies the fmt.Stringer interface.

func (Time) Time

func (t Time) Time() time.Time

Time returns a time.Time.

func (Time) Value

func (t Time) Value() (driver.Value, error)

Value satisfies the sql/driver.Valuer interface.

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

func UserByName(ctx context.Context, db DB, name string) ([]*User, error)

UserByName retrieves a row from 'user' as a User.

Generated from index 'idx_user_name'.

func UserByUserID

func UserByUserID(ctx context.Context, db DB, userID int) (*User, error)

UserByUserID retrieves a row from 'user' as a User.

Generated from index 'user_user_id_pkey'.

func (*User) Delete

func (u *User) Delete(ctx context.Context, db DB) error

Delete deletes the User from the database.

func (*User) Deleted

func (u *User) Deleted() bool

Deleted returns true when the User has been marked for deletion from the database.

func (*User) Exists

func (u *User) Exists() bool

Exists returns true when the User exists in the database.

func (*User) Insert

func (u *User) Insert(ctx context.Context, db DB) error

Insert inserts the User to the database.

func (*User) Save

func (u *User) Save(ctx context.Context, db DB) error

Save saves the User to the database.

func (*User) Update

func (u *User) Update(ctx context.Context, db DB) error

Update updates a User in the database.

func (*User) Upsert

func (u *User) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for User.

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
	ShareCount      int `json:"share_count"`      // share_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

func WxGroupByGroupID(ctx context.Context, db DB, groupID int) (*WxGroup, error)

WxGroupByGroupID retrieves a row from 'wx_group' as a WxGroup.

Generated from index 'wx_group_group_id_pkey'.

func WxGroupByName

func WxGroupByName(ctx context.Context, db DB, name string) ([]*WxGroup, error)

WxGroupByName retrieves a row from 'wx_group' as a WxGroup.

Generated from index 'idx_wx_group_name'.

func (*WxGroup) Delete

func (wg *WxGroup) Delete(ctx context.Context, db DB) error

Delete deletes the WxGroup from the database.

func (*WxGroup) Deleted

func (wg *WxGroup) Deleted() bool

Deleted returns true when the WxGroup has been marked for deletion from the database.

func (*WxGroup) Exists

func (wg *WxGroup) Exists() bool

Exists returns true when the WxGroup exists in the database.

func (*WxGroup) Insert

func (wg *WxGroup) Insert(ctx context.Context, db DB) error

Insert inserts the WxGroup to the database.

func (*WxGroup) Save

func (wg *WxGroup) Save(ctx context.Context, db DB) error

Save saves the WxGroup to the database.

func (*WxGroup) Update

func (wg *WxGroup) Update(ctx context.Context, db DB) error

Update updates a WxGroup in the database.

func (*WxGroup) Upsert

func (wg *WxGroup) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for WxGroup.

Jump to

Keyboard shortcuts

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