mirror of
https://github.com/dalbodeule/hop-gate.git
synced 2025-12-09 05:15:44 +09:00
feat(store): integrate postgres with ent for domain management
This commit is contained in:
99
ent/domain/domain.go
Normal file
99
ent/domain/domain.go
Normal file
@@ -0,0 +1,99 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package domain
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the domain type in the database.
|
||||
Label = "domain"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldDomain holds the string denoting the domain field in the database.
|
||||
FieldDomain = "domain"
|
||||
// FieldClientAPIKey holds the string denoting the client_api_key field in the database.
|
||||
FieldClientAPIKey = "client_api_key"
|
||||
// FieldMemo holds the string denoting the memo field in the database.
|
||||
FieldMemo = "memo"
|
||||
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
||||
FieldCreatedAt = "created_at"
|
||||
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
|
||||
FieldUpdatedAt = "updated_at"
|
||||
// Table holds the table name of the domain in the database.
|
||||
Table = "domains"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for domain fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldDomain,
|
||||
FieldClientAPIKey,
|
||||
FieldMemo,
|
||||
FieldCreatedAt,
|
||||
FieldUpdatedAt,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
if column == Columns[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// DomainValidator is a validator for the "domain" field. It is called by the builders before save.
|
||||
DomainValidator func(string) error
|
||||
// ClientAPIKeyValidator is a validator for the "client_api_key" field. It is called by the builders before save.
|
||||
ClientAPIKeyValidator func(string) error
|
||||
// DefaultMemo holds the default value on creation for the "memo" field.
|
||||
DefaultMemo string
|
||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||
DefaultCreatedAt func() time.Time
|
||||
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
||||
DefaultUpdatedAt func() time.Time
|
||||
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
||||
UpdateDefaultUpdatedAt func() time.Time
|
||||
// DefaultID holds the default value on creation for the "id" field.
|
||||
DefaultID func() uuid.UUID
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Domain queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDomain orders the results by the domain field.
|
||||
func ByDomain(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDomain, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByClientAPIKey orders the results by the client_api_key field.
|
||||
func ByClientAPIKey(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldClientAPIKey, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMemo orders the results by the memo field.
|
||||
func ByMemo(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMemo, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreatedAt orders the results by the created_at field.
|
||||
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdatedAt orders the results by the updated_at field.
|
||||
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
|
||||
}
|
||||
Reference in New Issue
Block a user