🚧 Refactor basic services
This commit is contained in:
389
internal/models/ent/entql.go
Normal file
389
internal/models/ent/entql.go
Normal file
@@ -0,0 +1,389 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"voidraft/internal/models/ent/document"
|
||||
"voidraft/internal/models/ent/extension"
|
||||
"voidraft/internal/models/ent/keybinding"
|
||||
"voidraft/internal/models/ent/theme"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/entql"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// schemaGraph holds a representation of ent/schema at runtime.
|
||||
var schemaGraph = func() *sqlgraph.Schema {
|
||||
graph := &sqlgraph.Schema{Nodes: make([]*sqlgraph.Node, 4)}
|
||||
graph.Nodes[0] = &sqlgraph.Node{
|
||||
NodeSpec: sqlgraph.NodeSpec{
|
||||
Table: document.Table,
|
||||
Columns: document.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: document.FieldID,
|
||||
},
|
||||
},
|
||||
Type: "Document",
|
||||
Fields: map[string]*sqlgraph.FieldSpec{
|
||||
document.FieldCreatedAt: {Type: field.TypeString, Column: document.FieldCreatedAt},
|
||||
document.FieldUpdatedAt: {Type: field.TypeString, Column: document.FieldUpdatedAt},
|
||||
document.FieldDeletedAt: {Type: field.TypeString, Column: document.FieldDeletedAt},
|
||||
document.FieldTitle: {Type: field.TypeString, Column: document.FieldTitle},
|
||||
document.FieldContent: {Type: field.TypeString, Column: document.FieldContent},
|
||||
document.FieldLocked: {Type: field.TypeBool, Column: document.FieldLocked},
|
||||
},
|
||||
}
|
||||
graph.Nodes[1] = &sqlgraph.Node{
|
||||
NodeSpec: sqlgraph.NodeSpec{
|
||||
Table: extension.Table,
|
||||
Columns: extension.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: extension.FieldID,
|
||||
},
|
||||
},
|
||||
Type: "Extension",
|
||||
Fields: map[string]*sqlgraph.FieldSpec{
|
||||
extension.FieldCreatedAt: {Type: field.TypeString, Column: extension.FieldCreatedAt},
|
||||
extension.FieldUpdatedAt: {Type: field.TypeString, Column: extension.FieldUpdatedAt},
|
||||
extension.FieldDeletedAt: {Type: field.TypeString, Column: extension.FieldDeletedAt},
|
||||
extension.FieldKey: {Type: field.TypeString, Column: extension.FieldKey},
|
||||
extension.FieldEnabled: {Type: field.TypeBool, Column: extension.FieldEnabled},
|
||||
extension.FieldConfig: {Type: field.TypeJSON, Column: extension.FieldConfig},
|
||||
},
|
||||
}
|
||||
graph.Nodes[2] = &sqlgraph.Node{
|
||||
NodeSpec: sqlgraph.NodeSpec{
|
||||
Table: keybinding.Table,
|
||||
Columns: keybinding.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: keybinding.FieldID,
|
||||
},
|
||||
},
|
||||
Type: "KeyBinding",
|
||||
Fields: map[string]*sqlgraph.FieldSpec{
|
||||
keybinding.FieldCreatedAt: {Type: field.TypeString, Column: keybinding.FieldCreatedAt},
|
||||
keybinding.FieldUpdatedAt: {Type: field.TypeString, Column: keybinding.FieldUpdatedAt},
|
||||
keybinding.FieldDeletedAt: {Type: field.TypeString, Column: keybinding.FieldDeletedAt},
|
||||
keybinding.FieldKey: {Type: field.TypeString, Column: keybinding.FieldKey},
|
||||
keybinding.FieldCommand: {Type: field.TypeString, Column: keybinding.FieldCommand},
|
||||
keybinding.FieldExtension: {Type: field.TypeString, Column: keybinding.FieldExtension},
|
||||
keybinding.FieldEnabled: {Type: field.TypeBool, Column: keybinding.FieldEnabled},
|
||||
},
|
||||
}
|
||||
graph.Nodes[3] = &sqlgraph.Node{
|
||||
NodeSpec: sqlgraph.NodeSpec{
|
||||
Table: theme.Table,
|
||||
Columns: theme.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: theme.FieldID,
|
||||
},
|
||||
},
|
||||
Type: "Theme",
|
||||
Fields: map[string]*sqlgraph.FieldSpec{
|
||||
theme.FieldCreatedAt: {Type: field.TypeString, Column: theme.FieldCreatedAt},
|
||||
theme.FieldUpdatedAt: {Type: field.TypeString, Column: theme.FieldUpdatedAt},
|
||||
theme.FieldDeletedAt: {Type: field.TypeString, Column: theme.FieldDeletedAt},
|
||||
theme.FieldKey: {Type: field.TypeString, Column: theme.FieldKey},
|
||||
theme.FieldType: {Type: field.TypeEnum, Column: theme.FieldType},
|
||||
theme.FieldColors: {Type: field.TypeJSON, Column: theme.FieldColors},
|
||||
},
|
||||
}
|
||||
return graph
|
||||
}()
|
||||
|
||||
// predicateAdder wraps the addPredicate method.
|
||||
// All update, update-one and query builders implement this interface.
|
||||
type predicateAdder interface {
|
||||
addPredicate(func(s *sql.Selector))
|
||||
}
|
||||
|
||||
// addPredicate implements the predicateAdder interface.
|
||||
func (_q *DocumentQuery) addPredicate(pred func(s *sql.Selector)) {
|
||||
_q.predicates = append(_q.predicates, pred)
|
||||
}
|
||||
|
||||
// Filter returns a Filter implementation to apply filters on the DocumentQuery builder.
|
||||
func (_q *DocumentQuery) Filter() *DocumentFilter {
|
||||
return &DocumentFilter{config: _q.config, predicateAdder: _q}
|
||||
}
|
||||
|
||||
// addPredicate implements the predicateAdder interface.
|
||||
func (m *DocumentMutation) addPredicate(pred func(s *sql.Selector)) {
|
||||
m.predicates = append(m.predicates, pred)
|
||||
}
|
||||
|
||||
// Filter returns an entql.Where implementation to apply filters on the DocumentMutation builder.
|
||||
func (m *DocumentMutation) Filter() *DocumentFilter {
|
||||
return &DocumentFilter{config: m.config, predicateAdder: m}
|
||||
}
|
||||
|
||||
// DocumentFilter provides a generic filtering capability at runtime for DocumentQuery.
|
||||
type DocumentFilter struct {
|
||||
predicateAdder
|
||||
config
|
||||
}
|
||||
|
||||
// Where applies the entql predicate on the query filter.
|
||||
func (f *DocumentFilter) Where(p entql.P) {
|
||||
f.addPredicate(func(s *sql.Selector) {
|
||||
if err := schemaGraph.EvalP(schemaGraph.Nodes[0].Type, p, s); err != nil {
|
||||
s.AddError(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// WhereID applies the entql int predicate on the id field.
|
||||
func (f *DocumentFilter) WhereID(p entql.IntP) {
|
||||
f.Where(p.Field(document.FieldID))
|
||||
}
|
||||
|
||||
// WhereCreatedAt applies the entql string predicate on the created_at field.
|
||||
func (f *DocumentFilter) WhereCreatedAt(p entql.StringP) {
|
||||
f.Where(p.Field(document.FieldCreatedAt))
|
||||
}
|
||||
|
||||
// WhereUpdatedAt applies the entql string predicate on the updated_at field.
|
||||
func (f *DocumentFilter) WhereUpdatedAt(p entql.StringP) {
|
||||
f.Where(p.Field(document.FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// WhereDeletedAt applies the entql string predicate on the deleted_at field.
|
||||
func (f *DocumentFilter) WhereDeletedAt(p entql.StringP) {
|
||||
f.Where(p.Field(document.FieldDeletedAt))
|
||||
}
|
||||
|
||||
// WhereTitle applies the entql string predicate on the title field.
|
||||
func (f *DocumentFilter) WhereTitle(p entql.StringP) {
|
||||
f.Where(p.Field(document.FieldTitle))
|
||||
}
|
||||
|
||||
// WhereContent applies the entql string predicate on the content field.
|
||||
func (f *DocumentFilter) WhereContent(p entql.StringP) {
|
||||
f.Where(p.Field(document.FieldContent))
|
||||
}
|
||||
|
||||
// WhereLocked applies the entql bool predicate on the locked field.
|
||||
func (f *DocumentFilter) WhereLocked(p entql.BoolP) {
|
||||
f.Where(p.Field(document.FieldLocked))
|
||||
}
|
||||
|
||||
// addPredicate implements the predicateAdder interface.
|
||||
func (_q *ExtensionQuery) addPredicate(pred func(s *sql.Selector)) {
|
||||
_q.predicates = append(_q.predicates, pred)
|
||||
}
|
||||
|
||||
// Filter returns a Filter implementation to apply filters on the ExtensionQuery builder.
|
||||
func (_q *ExtensionQuery) Filter() *ExtensionFilter {
|
||||
return &ExtensionFilter{config: _q.config, predicateAdder: _q}
|
||||
}
|
||||
|
||||
// addPredicate implements the predicateAdder interface.
|
||||
func (m *ExtensionMutation) addPredicate(pred func(s *sql.Selector)) {
|
||||
m.predicates = append(m.predicates, pred)
|
||||
}
|
||||
|
||||
// Filter returns an entql.Where implementation to apply filters on the ExtensionMutation builder.
|
||||
func (m *ExtensionMutation) Filter() *ExtensionFilter {
|
||||
return &ExtensionFilter{config: m.config, predicateAdder: m}
|
||||
}
|
||||
|
||||
// ExtensionFilter provides a generic filtering capability at runtime for ExtensionQuery.
|
||||
type ExtensionFilter struct {
|
||||
predicateAdder
|
||||
config
|
||||
}
|
||||
|
||||
// Where applies the entql predicate on the query filter.
|
||||
func (f *ExtensionFilter) Where(p entql.P) {
|
||||
f.addPredicate(func(s *sql.Selector) {
|
||||
if err := schemaGraph.EvalP(schemaGraph.Nodes[1].Type, p, s); err != nil {
|
||||
s.AddError(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// WhereID applies the entql int predicate on the id field.
|
||||
func (f *ExtensionFilter) WhereID(p entql.IntP) {
|
||||
f.Where(p.Field(extension.FieldID))
|
||||
}
|
||||
|
||||
// WhereCreatedAt applies the entql string predicate on the created_at field.
|
||||
func (f *ExtensionFilter) WhereCreatedAt(p entql.StringP) {
|
||||
f.Where(p.Field(extension.FieldCreatedAt))
|
||||
}
|
||||
|
||||
// WhereUpdatedAt applies the entql string predicate on the updated_at field.
|
||||
func (f *ExtensionFilter) WhereUpdatedAt(p entql.StringP) {
|
||||
f.Where(p.Field(extension.FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// WhereDeletedAt applies the entql string predicate on the deleted_at field.
|
||||
func (f *ExtensionFilter) WhereDeletedAt(p entql.StringP) {
|
||||
f.Where(p.Field(extension.FieldDeletedAt))
|
||||
}
|
||||
|
||||
// WhereKey applies the entql string predicate on the key field.
|
||||
func (f *ExtensionFilter) WhereKey(p entql.StringP) {
|
||||
f.Where(p.Field(extension.FieldKey))
|
||||
}
|
||||
|
||||
// WhereEnabled applies the entql bool predicate on the enabled field.
|
||||
func (f *ExtensionFilter) WhereEnabled(p entql.BoolP) {
|
||||
f.Where(p.Field(extension.FieldEnabled))
|
||||
}
|
||||
|
||||
// WhereConfig applies the entql json.RawMessage predicate on the config field.
|
||||
func (f *ExtensionFilter) WhereConfig(p entql.BytesP) {
|
||||
f.Where(p.Field(extension.FieldConfig))
|
||||
}
|
||||
|
||||
// addPredicate implements the predicateAdder interface.
|
||||
func (_q *KeyBindingQuery) addPredicate(pred func(s *sql.Selector)) {
|
||||
_q.predicates = append(_q.predicates, pred)
|
||||
}
|
||||
|
||||
// Filter returns a Filter implementation to apply filters on the KeyBindingQuery builder.
|
||||
func (_q *KeyBindingQuery) Filter() *KeyBindingFilter {
|
||||
return &KeyBindingFilter{config: _q.config, predicateAdder: _q}
|
||||
}
|
||||
|
||||
// addPredicate implements the predicateAdder interface.
|
||||
func (m *KeyBindingMutation) addPredicate(pred func(s *sql.Selector)) {
|
||||
m.predicates = append(m.predicates, pred)
|
||||
}
|
||||
|
||||
// Filter returns an entql.Where implementation to apply filters on the KeyBindingMutation builder.
|
||||
func (m *KeyBindingMutation) Filter() *KeyBindingFilter {
|
||||
return &KeyBindingFilter{config: m.config, predicateAdder: m}
|
||||
}
|
||||
|
||||
// KeyBindingFilter provides a generic filtering capability at runtime for KeyBindingQuery.
|
||||
type KeyBindingFilter struct {
|
||||
predicateAdder
|
||||
config
|
||||
}
|
||||
|
||||
// Where applies the entql predicate on the query filter.
|
||||
func (f *KeyBindingFilter) Where(p entql.P) {
|
||||
f.addPredicate(func(s *sql.Selector) {
|
||||
if err := schemaGraph.EvalP(schemaGraph.Nodes[2].Type, p, s); err != nil {
|
||||
s.AddError(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// WhereID applies the entql int predicate on the id field.
|
||||
func (f *KeyBindingFilter) WhereID(p entql.IntP) {
|
||||
f.Where(p.Field(keybinding.FieldID))
|
||||
}
|
||||
|
||||
// WhereCreatedAt applies the entql string predicate on the created_at field.
|
||||
func (f *KeyBindingFilter) WhereCreatedAt(p entql.StringP) {
|
||||
f.Where(p.Field(keybinding.FieldCreatedAt))
|
||||
}
|
||||
|
||||
// WhereUpdatedAt applies the entql string predicate on the updated_at field.
|
||||
func (f *KeyBindingFilter) WhereUpdatedAt(p entql.StringP) {
|
||||
f.Where(p.Field(keybinding.FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// WhereDeletedAt applies the entql string predicate on the deleted_at field.
|
||||
func (f *KeyBindingFilter) WhereDeletedAt(p entql.StringP) {
|
||||
f.Where(p.Field(keybinding.FieldDeletedAt))
|
||||
}
|
||||
|
||||
// WhereKey applies the entql string predicate on the key field.
|
||||
func (f *KeyBindingFilter) WhereKey(p entql.StringP) {
|
||||
f.Where(p.Field(keybinding.FieldKey))
|
||||
}
|
||||
|
||||
// WhereCommand applies the entql string predicate on the command field.
|
||||
func (f *KeyBindingFilter) WhereCommand(p entql.StringP) {
|
||||
f.Where(p.Field(keybinding.FieldCommand))
|
||||
}
|
||||
|
||||
// WhereExtension applies the entql string predicate on the extension field.
|
||||
func (f *KeyBindingFilter) WhereExtension(p entql.StringP) {
|
||||
f.Where(p.Field(keybinding.FieldExtension))
|
||||
}
|
||||
|
||||
// WhereEnabled applies the entql bool predicate on the enabled field.
|
||||
func (f *KeyBindingFilter) WhereEnabled(p entql.BoolP) {
|
||||
f.Where(p.Field(keybinding.FieldEnabled))
|
||||
}
|
||||
|
||||
// addPredicate implements the predicateAdder interface.
|
||||
func (_q *ThemeQuery) addPredicate(pred func(s *sql.Selector)) {
|
||||
_q.predicates = append(_q.predicates, pred)
|
||||
}
|
||||
|
||||
// Filter returns a Filter implementation to apply filters on the ThemeQuery builder.
|
||||
func (_q *ThemeQuery) Filter() *ThemeFilter {
|
||||
return &ThemeFilter{config: _q.config, predicateAdder: _q}
|
||||
}
|
||||
|
||||
// addPredicate implements the predicateAdder interface.
|
||||
func (m *ThemeMutation) addPredicate(pred func(s *sql.Selector)) {
|
||||
m.predicates = append(m.predicates, pred)
|
||||
}
|
||||
|
||||
// Filter returns an entql.Where implementation to apply filters on the ThemeMutation builder.
|
||||
func (m *ThemeMutation) Filter() *ThemeFilter {
|
||||
return &ThemeFilter{config: m.config, predicateAdder: m}
|
||||
}
|
||||
|
||||
// ThemeFilter provides a generic filtering capability at runtime for ThemeQuery.
|
||||
type ThemeFilter struct {
|
||||
predicateAdder
|
||||
config
|
||||
}
|
||||
|
||||
// Where applies the entql predicate on the query filter.
|
||||
func (f *ThemeFilter) Where(p entql.P) {
|
||||
f.addPredicate(func(s *sql.Selector) {
|
||||
if err := schemaGraph.EvalP(schemaGraph.Nodes[3].Type, p, s); err != nil {
|
||||
s.AddError(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// WhereID applies the entql int predicate on the id field.
|
||||
func (f *ThemeFilter) WhereID(p entql.IntP) {
|
||||
f.Where(p.Field(theme.FieldID))
|
||||
}
|
||||
|
||||
// WhereCreatedAt applies the entql string predicate on the created_at field.
|
||||
func (f *ThemeFilter) WhereCreatedAt(p entql.StringP) {
|
||||
f.Where(p.Field(theme.FieldCreatedAt))
|
||||
}
|
||||
|
||||
// WhereUpdatedAt applies the entql string predicate on the updated_at field.
|
||||
func (f *ThemeFilter) WhereUpdatedAt(p entql.StringP) {
|
||||
f.Where(p.Field(theme.FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// WhereDeletedAt applies the entql string predicate on the deleted_at field.
|
||||
func (f *ThemeFilter) WhereDeletedAt(p entql.StringP) {
|
||||
f.Where(p.Field(theme.FieldDeletedAt))
|
||||
}
|
||||
|
||||
// WhereKey applies the entql string predicate on the key field.
|
||||
func (f *ThemeFilter) WhereKey(p entql.StringP) {
|
||||
f.Where(p.Field(theme.FieldKey))
|
||||
}
|
||||
|
||||
// WhereType applies the entql string predicate on the type field.
|
||||
func (f *ThemeFilter) WhereType(p entql.StringP) {
|
||||
f.Where(p.Field(theme.FieldType))
|
||||
}
|
||||
|
||||
// WhereColors applies the entql json.RawMessage predicate on the colors field.
|
||||
func (f *ThemeFilter) WhereColors(p entql.BytesP) {
|
||||
f.Where(p.Field(theme.FieldColors))
|
||||
}
|
||||
Reference in New Issue
Block a user