Files
kannn 2cd3052da1
golangci-lint / lint (push) Failing after 1m5s
rebrand: frp -> kanhole (kanhole server, kanholec client)
2026-05-29 09:05:34 +00:00

217 lines
7.3 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"kanhole/pkg/db/ent/proxy"
)
// Proxy is the model entity for the Proxy schema.
type Proxy struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// Name holds the value of the "name" field.
Name string `json:"name,omitempty"`
// ProxyType holds the value of the "proxy_type" field.
ProxyType string `json:"proxy_type,omitempty"`
// LocalIP holds the value of the "local_ip" field.
LocalIP string `json:"local_ip,omitempty"`
// LocalPort holds the value of the "local_port" field.
LocalPort int `json:"local_port,omitempty"`
// RemotePort holds the value of the "remote_port" field.
RemotePort int `json:"remote_port,omitempty"`
// Status holds the value of the "status" field.
Status string `json:"status,omitempty"`
// CustomDomains holds the value of the "custom_domains" field.
CustomDomains string `json:"custom_domains,omitempty"`
// Metadata holds the value of the "metadata" field.
Metadata string `json:"metadata,omitempty"`
// ClientID holds the value of the "client_id" field.
ClientID int `json:"client_id,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
UpdatedAt time.Time `json:"updated_at,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*Proxy) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case proxy.FieldID, proxy.FieldLocalPort, proxy.FieldRemotePort, proxy.FieldClientID:
values[i] = new(sql.NullInt64)
case proxy.FieldName, proxy.FieldProxyType, proxy.FieldLocalIP, proxy.FieldStatus, proxy.FieldCustomDomains, proxy.FieldMetadata:
values[i] = new(sql.NullString)
case proxy.FieldCreatedAt, proxy.FieldUpdatedAt:
values[i] = new(sql.NullTime)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Proxy fields.
func (_m *Proxy) assignValues(columns []string, values []any) 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 proxy.FieldID:
value, ok := values[i].(*sql.NullInt64)
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
_m.ID = int(value.Int64)
case proxy.FieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name", values[i])
} else if value.Valid {
_m.Name = value.String
}
case proxy.FieldProxyType:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field proxy_type", values[i])
} else if value.Valid {
_m.ProxyType = value.String
}
case proxy.FieldLocalIP:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field local_ip", values[i])
} else if value.Valid {
_m.LocalIP = value.String
}
case proxy.FieldLocalPort:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field local_port", values[i])
} else if value.Valid {
_m.LocalPort = int(value.Int64)
}
case proxy.FieldRemotePort:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field remote_port", values[i])
} else if value.Valid {
_m.RemotePort = int(value.Int64)
}
case proxy.FieldStatus:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field status", values[i])
} else if value.Valid {
_m.Status = value.String
}
case proxy.FieldCustomDomains:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field custom_domains", values[i])
} else if value.Valid {
_m.CustomDomains = value.String
}
case proxy.FieldMetadata:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field metadata", values[i])
} else if value.Valid {
_m.Metadata = value.String
}
case proxy.FieldClientID:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field client_id", values[i])
} else if value.Valid {
_m.ClientID = int(value.Int64)
}
case proxy.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
_m.CreatedAt = value.Time
}
case proxy.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
_m.UpdatedAt = value.Time
}
default:
_m.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the Proxy.
// This includes values selected through modifiers, order, etc.
func (_m *Proxy) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// Update returns a builder for updating this Proxy.
// Note that you need to call Proxy.Unwrap() before calling this method if this Proxy
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *Proxy) Update() *ProxyUpdateOne {
return NewProxyClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the Proxy 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 (_m *Proxy) Unwrap() *Proxy {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: Proxy is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *Proxy) String() string {
var builder strings.Builder
builder.WriteString("Proxy(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("name=")
builder.WriteString(_m.Name)
builder.WriteString(", ")
builder.WriteString("proxy_type=")
builder.WriteString(_m.ProxyType)
builder.WriteString(", ")
builder.WriteString("local_ip=")
builder.WriteString(_m.LocalIP)
builder.WriteString(", ")
builder.WriteString("local_port=")
builder.WriteString(fmt.Sprintf("%v", _m.LocalPort))
builder.WriteString(", ")
builder.WriteString("remote_port=")
builder.WriteString(fmt.Sprintf("%v", _m.RemotePort))
builder.WriteString(", ")
builder.WriteString("status=")
builder.WriteString(_m.Status)
builder.WriteString(", ")
builder.WriteString("custom_domains=")
builder.WriteString(_m.CustomDomains)
builder.WriteString(", ")
builder.WriteString("metadata=")
builder.WriteString(_m.Metadata)
builder.WriteString(", ")
builder.WriteString("client_id=")
builder.WriteString(fmt.Sprintf("%v", _m.ClientID))
builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
builder.WriteByte(')')
return builder.String()
}
// Proxies is a parsable slice of Proxy.
type Proxies []*Proxy