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()
|
||||
}
|
||||
371
ent/domain/where.go
Normal file
371
ent/domain/where.go
Normal file
@@ -0,0 +1,371 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package domain
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"github.com/dalbodeule/hop-gate/ent/predicate"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id uuid.UUID) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id uuid.UUID) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id uuid.UUID) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id uuid.UUID) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id uuid.UUID) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id uuid.UUID) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id uuid.UUID) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// Domain applies equality check predicate on the "domain" field. It's identical to DomainEQ.
|
||||
func Domain(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEQ(FieldDomain, v))
|
||||
}
|
||||
|
||||
// ClientAPIKey applies equality check predicate on the "client_api_key" field. It's identical to ClientAPIKeyEQ.
|
||||
func ClientAPIKey(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEQ(FieldClientAPIKey, v))
|
||||
}
|
||||
|
||||
// Memo applies equality check predicate on the "memo" field. It's identical to MemoEQ.
|
||||
func Memo(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEQ(FieldMemo, v))
|
||||
}
|
||||
|
||||
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
|
||||
func CreatedAt(v time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
|
||||
func UpdatedAt(v time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// DomainEQ applies the EQ predicate on the "domain" field.
|
||||
func DomainEQ(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEQ(FieldDomain, v))
|
||||
}
|
||||
|
||||
// DomainNEQ applies the NEQ predicate on the "domain" field.
|
||||
func DomainNEQ(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldNEQ(FieldDomain, v))
|
||||
}
|
||||
|
||||
// DomainIn applies the In predicate on the "domain" field.
|
||||
func DomainIn(vs ...string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldIn(FieldDomain, vs...))
|
||||
}
|
||||
|
||||
// DomainNotIn applies the NotIn predicate on the "domain" field.
|
||||
func DomainNotIn(vs ...string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldNotIn(FieldDomain, vs...))
|
||||
}
|
||||
|
||||
// DomainGT applies the GT predicate on the "domain" field.
|
||||
func DomainGT(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldGT(FieldDomain, v))
|
||||
}
|
||||
|
||||
// DomainGTE applies the GTE predicate on the "domain" field.
|
||||
func DomainGTE(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldGTE(FieldDomain, v))
|
||||
}
|
||||
|
||||
// DomainLT applies the LT predicate on the "domain" field.
|
||||
func DomainLT(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldLT(FieldDomain, v))
|
||||
}
|
||||
|
||||
// DomainLTE applies the LTE predicate on the "domain" field.
|
||||
func DomainLTE(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldLTE(FieldDomain, v))
|
||||
}
|
||||
|
||||
// DomainContains applies the Contains predicate on the "domain" field.
|
||||
func DomainContains(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldContains(FieldDomain, v))
|
||||
}
|
||||
|
||||
// DomainHasPrefix applies the HasPrefix predicate on the "domain" field.
|
||||
func DomainHasPrefix(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldHasPrefix(FieldDomain, v))
|
||||
}
|
||||
|
||||
// DomainHasSuffix applies the HasSuffix predicate on the "domain" field.
|
||||
func DomainHasSuffix(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldHasSuffix(FieldDomain, v))
|
||||
}
|
||||
|
||||
// DomainEqualFold applies the EqualFold predicate on the "domain" field.
|
||||
func DomainEqualFold(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEqualFold(FieldDomain, v))
|
||||
}
|
||||
|
||||
// DomainContainsFold applies the ContainsFold predicate on the "domain" field.
|
||||
func DomainContainsFold(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldContainsFold(FieldDomain, v))
|
||||
}
|
||||
|
||||
// ClientAPIKeyEQ applies the EQ predicate on the "client_api_key" field.
|
||||
func ClientAPIKeyEQ(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEQ(FieldClientAPIKey, v))
|
||||
}
|
||||
|
||||
// ClientAPIKeyNEQ applies the NEQ predicate on the "client_api_key" field.
|
||||
func ClientAPIKeyNEQ(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldNEQ(FieldClientAPIKey, v))
|
||||
}
|
||||
|
||||
// ClientAPIKeyIn applies the In predicate on the "client_api_key" field.
|
||||
func ClientAPIKeyIn(vs ...string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldIn(FieldClientAPIKey, vs...))
|
||||
}
|
||||
|
||||
// ClientAPIKeyNotIn applies the NotIn predicate on the "client_api_key" field.
|
||||
func ClientAPIKeyNotIn(vs ...string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldNotIn(FieldClientAPIKey, vs...))
|
||||
}
|
||||
|
||||
// ClientAPIKeyGT applies the GT predicate on the "client_api_key" field.
|
||||
func ClientAPIKeyGT(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldGT(FieldClientAPIKey, v))
|
||||
}
|
||||
|
||||
// ClientAPIKeyGTE applies the GTE predicate on the "client_api_key" field.
|
||||
func ClientAPIKeyGTE(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldGTE(FieldClientAPIKey, v))
|
||||
}
|
||||
|
||||
// ClientAPIKeyLT applies the LT predicate on the "client_api_key" field.
|
||||
func ClientAPIKeyLT(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldLT(FieldClientAPIKey, v))
|
||||
}
|
||||
|
||||
// ClientAPIKeyLTE applies the LTE predicate on the "client_api_key" field.
|
||||
func ClientAPIKeyLTE(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldLTE(FieldClientAPIKey, v))
|
||||
}
|
||||
|
||||
// ClientAPIKeyContains applies the Contains predicate on the "client_api_key" field.
|
||||
func ClientAPIKeyContains(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldContains(FieldClientAPIKey, v))
|
||||
}
|
||||
|
||||
// ClientAPIKeyHasPrefix applies the HasPrefix predicate on the "client_api_key" field.
|
||||
func ClientAPIKeyHasPrefix(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldHasPrefix(FieldClientAPIKey, v))
|
||||
}
|
||||
|
||||
// ClientAPIKeyHasSuffix applies the HasSuffix predicate on the "client_api_key" field.
|
||||
func ClientAPIKeyHasSuffix(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldHasSuffix(FieldClientAPIKey, v))
|
||||
}
|
||||
|
||||
// ClientAPIKeyEqualFold applies the EqualFold predicate on the "client_api_key" field.
|
||||
func ClientAPIKeyEqualFold(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEqualFold(FieldClientAPIKey, v))
|
||||
}
|
||||
|
||||
// ClientAPIKeyContainsFold applies the ContainsFold predicate on the "client_api_key" field.
|
||||
func ClientAPIKeyContainsFold(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldContainsFold(FieldClientAPIKey, v))
|
||||
}
|
||||
|
||||
// MemoEQ applies the EQ predicate on the "memo" field.
|
||||
func MemoEQ(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEQ(FieldMemo, v))
|
||||
}
|
||||
|
||||
// MemoNEQ applies the NEQ predicate on the "memo" field.
|
||||
func MemoNEQ(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldNEQ(FieldMemo, v))
|
||||
}
|
||||
|
||||
// MemoIn applies the In predicate on the "memo" field.
|
||||
func MemoIn(vs ...string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldIn(FieldMemo, vs...))
|
||||
}
|
||||
|
||||
// MemoNotIn applies the NotIn predicate on the "memo" field.
|
||||
func MemoNotIn(vs ...string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldNotIn(FieldMemo, vs...))
|
||||
}
|
||||
|
||||
// MemoGT applies the GT predicate on the "memo" field.
|
||||
func MemoGT(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldGT(FieldMemo, v))
|
||||
}
|
||||
|
||||
// MemoGTE applies the GTE predicate on the "memo" field.
|
||||
func MemoGTE(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldGTE(FieldMemo, v))
|
||||
}
|
||||
|
||||
// MemoLT applies the LT predicate on the "memo" field.
|
||||
func MemoLT(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldLT(FieldMemo, v))
|
||||
}
|
||||
|
||||
// MemoLTE applies the LTE predicate on the "memo" field.
|
||||
func MemoLTE(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldLTE(FieldMemo, v))
|
||||
}
|
||||
|
||||
// MemoContains applies the Contains predicate on the "memo" field.
|
||||
func MemoContains(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldContains(FieldMemo, v))
|
||||
}
|
||||
|
||||
// MemoHasPrefix applies the HasPrefix predicate on the "memo" field.
|
||||
func MemoHasPrefix(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldHasPrefix(FieldMemo, v))
|
||||
}
|
||||
|
||||
// MemoHasSuffix applies the HasSuffix predicate on the "memo" field.
|
||||
func MemoHasSuffix(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldHasSuffix(FieldMemo, v))
|
||||
}
|
||||
|
||||
// MemoEqualFold applies the EqualFold predicate on the "memo" field.
|
||||
func MemoEqualFold(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEqualFold(FieldMemo, v))
|
||||
}
|
||||
|
||||
// MemoContainsFold applies the ContainsFold predicate on the "memo" field.
|
||||
func MemoContainsFold(v string) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldContainsFold(FieldMemo, v))
|
||||
}
|
||||
|
||||
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
||||
func CreatedAtEQ(v time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
|
||||
func CreatedAtNEQ(v time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldNEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldIn(FieldCreatedAt, vs...))
|
||||
}
|
||||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldNotIn(FieldCreatedAt, vs...))
|
||||
}
|
||||
|
||||
// CreatedAtGT applies the GT predicate on the "created_at" field.
|
||||
func CreatedAtGT(v time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldGT(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
|
||||
func CreatedAtGTE(v time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldGTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtLT applies the LT predicate on the "created_at" field.
|
||||
func CreatedAtLT(v time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldLT(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
|
||||
func CreatedAtLTE(v time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldLTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||
func UpdatedAtEQ(v time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
|
||||
func UpdatedAtNEQ(v time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldNEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldIn(FieldUpdatedAt, vs...))
|
||||
}
|
||||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldNotIn(FieldUpdatedAt, vs...))
|
||||
}
|
||||
|
||||
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
|
||||
func UpdatedAtGT(v time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldGT(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
|
||||
func UpdatedAtGTE(v time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldGTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
|
||||
func UpdatedAtLT(v time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldLT(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
|
||||
func UpdatedAtLTE(v time.Time) predicate.Domain {
|
||||
return predicate.Domain(sql.FieldLTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.Domain) predicate.Domain {
|
||||
return predicate.Domain(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.Domain) predicate.Domain {
|
||||
return predicate.Domain(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.Domain) predicate.Domain {
|
||||
return predicate.Domain(sql.NotPredicates(p))
|
||||
}
|
||||
Reference in New Issue
Block a user