feat: init

This commit is contained in:
Rogee
2024-09-30 11:02:26 +08:00
parent 679759846b
commit 694dfd2a4f
90 changed files with 6046 additions and 15 deletions

17
.gen/model/device.go Normal file
View File

@@ -0,0 +1,17 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package model
type Device struct {
ID int32 `sql:"primary_key"`
UUID string
Name string
Expert string
State string
Note string
}

21
.gen/model/expert.go Normal file
View File

@@ -0,0 +1,21 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package model
type Expert struct {
ID int32 `sql:"primary_key"`
UID string
SecUID string
ShortID string
RealName string
NickName string
State string
Since int32
Config string
ConfigAt int32
}

21
.gen/model/follower.go Normal file
View File

@@ -0,0 +1,21 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package model
type Follower struct {
ID int32 `sql:"primary_key"`
Avatar string
Nickname string
SecUID string
ShortID string
UID string
UniqueID string
ExpertUID string
Followed int32
CreatedAt int32
}

90
.gen/table/device.go Normal file
View File

@@ -0,0 +1,90 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package table
import (
"github.com/go-jet/jet/v2/sqlite"
)
var Device = newDeviceTable("", "device", "")
type deviceTable struct {
sqlite.Table
// Columns
ID sqlite.ColumnInteger
UUID sqlite.ColumnString
Name sqlite.ColumnString
Expert sqlite.ColumnString
State sqlite.ColumnString
Note sqlite.ColumnString
AllColumns sqlite.ColumnList
MutableColumns sqlite.ColumnList
}
type DeviceTable struct {
deviceTable
EXCLUDED deviceTable
}
// AS creates new DeviceTable with assigned alias
func (a DeviceTable) AS(alias string) *DeviceTable {
return newDeviceTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new DeviceTable with assigned schema name
func (a DeviceTable) FromSchema(schemaName string) *DeviceTable {
return newDeviceTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new DeviceTable with assigned table prefix
func (a DeviceTable) WithPrefix(prefix string) *DeviceTable {
return newDeviceTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new DeviceTable with assigned table suffix
func (a DeviceTable) WithSuffix(suffix string) *DeviceTable {
return newDeviceTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newDeviceTable(schemaName, tableName, alias string) *DeviceTable {
return &DeviceTable{
deviceTable: newDeviceTableImpl(schemaName, tableName, alias),
EXCLUDED: newDeviceTableImpl("", "excluded", ""),
}
}
func newDeviceTableImpl(schemaName, tableName, alias string) deviceTable {
var (
IDColumn = sqlite.IntegerColumn("id")
UUIDColumn = sqlite.StringColumn("uuid")
NameColumn = sqlite.StringColumn("name")
ExpertColumn = sqlite.StringColumn("expert")
StateColumn = sqlite.StringColumn("state")
NoteColumn = sqlite.StringColumn("note")
allColumns = sqlite.ColumnList{IDColumn, UUIDColumn, NameColumn, ExpertColumn, StateColumn, NoteColumn}
mutableColumns = sqlite.ColumnList{UUIDColumn, NameColumn, ExpertColumn, StateColumn, NoteColumn}
)
return deviceTable{
Table: sqlite.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
UUID: UUIDColumn,
Name: NameColumn,
Expert: ExpertColumn,
State: StateColumn,
Note: NoteColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

102
.gen/table/expert.go Normal file
View File

@@ -0,0 +1,102 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package table
import (
"github.com/go-jet/jet/v2/sqlite"
)
var Expert = newExpertTable("", "expert", "")
type expertTable struct {
sqlite.Table
// Columns
ID sqlite.ColumnInteger
UID sqlite.ColumnString
SecUID sqlite.ColumnString
ShortID sqlite.ColumnString
RealName sqlite.ColumnString
NickName sqlite.ColumnString
State sqlite.ColumnString
Since sqlite.ColumnInteger
Config sqlite.ColumnString
ConfigAt sqlite.ColumnInteger
AllColumns sqlite.ColumnList
MutableColumns sqlite.ColumnList
}
type ExpertTable struct {
expertTable
EXCLUDED expertTable
}
// AS creates new ExpertTable with assigned alias
func (a ExpertTable) AS(alias string) *ExpertTable {
return newExpertTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new ExpertTable with assigned schema name
func (a ExpertTable) FromSchema(schemaName string) *ExpertTable {
return newExpertTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new ExpertTable with assigned table prefix
func (a ExpertTable) WithPrefix(prefix string) *ExpertTable {
return newExpertTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new ExpertTable with assigned table suffix
func (a ExpertTable) WithSuffix(suffix string) *ExpertTable {
return newExpertTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newExpertTable(schemaName, tableName, alias string) *ExpertTable {
return &ExpertTable{
expertTable: newExpertTableImpl(schemaName, tableName, alias),
EXCLUDED: newExpertTableImpl("", "excluded", ""),
}
}
func newExpertTableImpl(schemaName, tableName, alias string) expertTable {
var (
IDColumn = sqlite.IntegerColumn("id")
UIDColumn = sqlite.StringColumn("uid")
SecUIDColumn = sqlite.StringColumn("sec_uid")
ShortIDColumn = sqlite.StringColumn("short_id")
RealNameColumn = sqlite.StringColumn("real_name")
NickNameColumn = sqlite.StringColumn("nick_name")
StateColumn = sqlite.StringColumn("state")
SinceColumn = sqlite.IntegerColumn("since")
ConfigColumn = sqlite.StringColumn("config")
ConfigAtColumn = sqlite.IntegerColumn("config_at")
allColumns = sqlite.ColumnList{IDColumn, UIDColumn, SecUIDColumn, ShortIDColumn, RealNameColumn, NickNameColumn, StateColumn, SinceColumn, ConfigColumn, ConfigAtColumn}
mutableColumns = sqlite.ColumnList{UIDColumn, SecUIDColumn, ShortIDColumn, RealNameColumn, NickNameColumn, StateColumn, SinceColumn, ConfigColumn, ConfigAtColumn}
)
return expertTable{
Table: sqlite.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
UID: UIDColumn,
SecUID: SecUIDColumn,
ShortID: ShortIDColumn,
RealName: RealNameColumn,
NickName: NickNameColumn,
State: StateColumn,
Since: SinceColumn,
Config: ConfigColumn,
ConfigAt: ConfigAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

102
.gen/table/follower.go Normal file
View File

@@ -0,0 +1,102 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package table
import (
"github.com/go-jet/jet/v2/sqlite"
)
var Follower = newFollowerTable("", "follower", "")
type followerTable struct {
sqlite.Table
// Columns
ID sqlite.ColumnInteger
Avatar sqlite.ColumnString
Nickname sqlite.ColumnString
SecUID sqlite.ColumnString
ShortID sqlite.ColumnString
UID sqlite.ColumnString
UniqueID sqlite.ColumnString
ExpertUID sqlite.ColumnString
Followed sqlite.ColumnInteger
CreatedAt sqlite.ColumnInteger
AllColumns sqlite.ColumnList
MutableColumns sqlite.ColumnList
}
type FollowerTable struct {
followerTable
EXCLUDED followerTable
}
// AS creates new FollowerTable with assigned alias
func (a FollowerTable) AS(alias string) *FollowerTable {
return newFollowerTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new FollowerTable with assigned schema name
func (a FollowerTable) FromSchema(schemaName string) *FollowerTable {
return newFollowerTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new FollowerTable with assigned table prefix
func (a FollowerTable) WithPrefix(prefix string) *FollowerTable {
return newFollowerTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new FollowerTable with assigned table suffix
func (a FollowerTable) WithSuffix(suffix string) *FollowerTable {
return newFollowerTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newFollowerTable(schemaName, tableName, alias string) *FollowerTable {
return &FollowerTable{
followerTable: newFollowerTableImpl(schemaName, tableName, alias),
EXCLUDED: newFollowerTableImpl("", "excluded", ""),
}
}
func newFollowerTableImpl(schemaName, tableName, alias string) followerTable {
var (
IDColumn = sqlite.IntegerColumn("id")
AvatarColumn = sqlite.StringColumn("avatar")
NicknameColumn = sqlite.StringColumn("nickname")
SecUIDColumn = sqlite.StringColumn("sec_uid")
ShortIDColumn = sqlite.StringColumn("short_id")
UIDColumn = sqlite.StringColumn("uid")
UniqueIDColumn = sqlite.StringColumn("unique_id")
ExpertUIDColumn = sqlite.StringColumn("expert_uid")
FollowedColumn = sqlite.IntegerColumn("followed")
CreatedAtColumn = sqlite.IntegerColumn("created_at")
allColumns = sqlite.ColumnList{IDColumn, AvatarColumn, NicknameColumn, SecUIDColumn, ShortIDColumn, UIDColumn, UniqueIDColumn, ExpertUIDColumn, FollowedColumn, CreatedAtColumn}
mutableColumns = sqlite.ColumnList{AvatarColumn, NicknameColumn, SecUIDColumn, ShortIDColumn, UIDColumn, UniqueIDColumn, ExpertUIDColumn, FollowedColumn, CreatedAtColumn}
)
return followerTable{
Table: sqlite.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
Avatar: AvatarColumn,
Nickname: NicknameColumn,
SecUID: SecUIDColumn,
ShortID: ShortIDColumn,
UID: UIDColumn,
UniqueID: UniqueIDColumn,
ExpertUID: ExpertUIDColumn,
Followed: FollowedColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View File

@@ -0,0 +1,16 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package table
// UseSchema sets a new schema name for all generated table SQL builder types. It is recommended to invoke
// this method only once at the beginning of the program.
func UseSchema(schema string) {
Device = Device.FromSchema(schema)
Expert = Expert.FromSchema(schema)
Follower = Follower.FromSchema(schema)
}