initial commit
This commit is contained in:
110
ent/blacklist.go
Normal file
110
ent/blacklist.go
Normal file
@@ -0,0 +1,110 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"github.com/FrankenBotDev/FrankenAPI/ent/blacklist"
|
||||
)
|
||||
|
||||
// Blacklist is the model entity for the Blacklist schema.
|
||||
type Blacklist struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
// Serverid holds the value of the "serverid" field.
|
||||
Serverid string `json:"serverid,omitempty"`
|
||||
// Word holds the value of the "word" field.
|
||||
Word string `json:"word,omitempty"`
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Blacklist) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case blacklist.FieldID:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case blacklist.FieldServerid, blacklist.FieldWord:
|
||||
values[i] = new(sql.NullString)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Blacklist", columns[i])
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Blacklist fields.
|
||||
func (b *Blacklist) assignValues(columns []string, values []interface{}) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case blacklist.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
b.ID = int(value.Int64)
|
||||
case blacklist.FieldServerid:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field serverid", values[i])
|
||||
} else if value.Valid {
|
||||
b.Serverid = value.String
|
||||
}
|
||||
case blacklist.FieldWord:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field word", values[i])
|
||||
} else if value.Valid {
|
||||
b.Word = value.String
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this Blacklist.
|
||||
// Note that you need to call Blacklist.Unwrap() before calling this method if this Blacklist
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (b *Blacklist) Update() *BlacklistUpdateOne {
|
||||
return (&BlacklistClient{config: b.config}).UpdateOne(b)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the Blacklist entity that was returned from a transaction after it was closed,
|
||||
// so that all future queries will be executed through the driver which created the transaction.
|
||||
func (b *Blacklist) Unwrap() *Blacklist {
|
||||
_tx, ok := b.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: Blacklist is not a transactional entity")
|
||||
}
|
||||
b.config.driver = _tx.drv
|
||||
return b
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (b *Blacklist) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("Blacklist(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", b.ID))
|
||||
builder.WriteString("serverid=")
|
||||
builder.WriteString(b.Serverid)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("word=")
|
||||
builder.WriteString(b.Word)
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// Blacklists is a parsable slice of Blacklist.
|
||||
type Blacklists []*Blacklist
|
||||
|
||||
func (b Blacklists) config(cfg config) {
|
||||
for _i := range b {
|
||||
b[_i].config = cfg
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user