feat:多项功能优化

This commit is contained in:
zhoujianjin
2026-09-18 18:54:54 +08:00
parent 672cd23329
commit 543655d441
48 changed files with 1289 additions and 447 deletions
+20
View File
@@ -23,6 +23,10 @@ const (
FieldStationType = "station_type"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldIsBuiltin holds the string denoting the isbuiltin field in the database.
FieldIsBuiltin = "is_builtin"
// FieldHasDock holds the string denoting the hasdock field in the database.
FieldHasDock = "has_dock"
// FieldCreatedAt holds the string denoting the createdat field in the database.
FieldCreatedAt = "created_at"
// Table holds the table name of the station in the database.
@@ -37,6 +41,8 @@ var Columns = []string{
FieldFlowId,
FieldStationType,
FieldStatus,
FieldIsBuiltin,
FieldHasDock,
FieldCreatedAt,
}
@@ -63,6 +69,10 @@ var (
DefaultStatus string
// StatusValidator is a validator for the "status" field. It is called by the builders before save.
StatusValidator func(string) error
// DefaultIsBuiltin holds the default value on creation for the "isBuiltin" field.
DefaultIsBuiltin bool
// DefaultHasDock holds the default value on creation for the "hasDock" field.
DefaultHasDock bool
// DefaultCreatedAt holds the default value on creation for the "createdAt" field.
DefaultCreatedAt func() time.Time
// IDValidator is a validator for the "id" field. It is called by the builders before save.
@@ -102,6 +112,16 @@ func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByIsBuiltin orders the results by the isBuiltin field.
func ByIsBuiltin(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIsBuiltin, opts...).ToFunc()
}
// ByHasDock orders the results by the hasDock field.
func ByHasDock(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldHasDock, opts...).ToFunc()
}
// ByCreatedAt orders the results by the createdAt field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()