[feature] migrate to monorepo
This commit is contained in:
commit
05ddc1f783
267 changed files with 75165 additions and 0 deletions
153
backend/ent/dailycontent.go
Normal file
153
backend/ent/dailycontent.go
Normal file
|
@ -0,0 +1,153 @@
|
|||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"tss-rocks-be/ent/daily"
|
||||
"tss-rocks-be/ent/dailycontent"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// DailyContent is the model entity for the DailyContent schema.
|
||||
type DailyContent struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
// LanguageCode holds the value of the "language_code" field.
|
||||
LanguageCode dailycontent.LanguageCode `json:"language_code,omitempty"`
|
||||
// Quote holds the value of the "quote" field.
|
||||
Quote string `json:"quote,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the DailyContentQuery when eager-loading is set.
|
||||
Edges DailyContentEdges `json:"edges"`
|
||||
daily_contents *string
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// DailyContentEdges holds the relations/edges for other nodes in the graph.
|
||||
type DailyContentEdges struct {
|
||||
// Daily holds the value of the daily edge.
|
||||
Daily *Daily `json:"daily,omitempty"`
|
||||
// loadedTypes holds the information for reporting if a
|
||||
// type was loaded (or requested) in eager-loading or not.
|
||||
loadedTypes [1]bool
|
||||
}
|
||||
|
||||
// DailyOrErr returns the Daily value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e DailyContentEdges) DailyOrErr() (*Daily, error) {
|
||||
if e.Daily != nil {
|
||||
return e.Daily, nil
|
||||
} else if e.loadedTypes[0] {
|
||||
return nil, &NotFoundError{label: daily.Label}
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "daily"}
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*DailyContent) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case dailycontent.FieldID:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case dailycontent.FieldLanguageCode, dailycontent.FieldQuote:
|
||||
values[i] = new(sql.NullString)
|
||||
case dailycontent.ForeignKeys[0]: // daily_contents
|
||||
values[i] = new(sql.NullString)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the DailyContent fields.
|
||||
func (dc *DailyContent) 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 dailycontent.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
dc.ID = int(value.Int64)
|
||||
case dailycontent.FieldLanguageCode:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field language_code", values[i])
|
||||
} else if value.Valid {
|
||||
dc.LanguageCode = dailycontent.LanguageCode(value.String)
|
||||
}
|
||||
case dailycontent.FieldQuote:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field quote", values[i])
|
||||
} else if value.Valid {
|
||||
dc.Quote = value.String
|
||||
}
|
||||
case dailycontent.ForeignKeys[0]:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field daily_contents", values[i])
|
||||
} else if value.Valid {
|
||||
dc.daily_contents = new(string)
|
||||
*dc.daily_contents = value.String
|
||||
}
|
||||
default:
|
||||
dc.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the DailyContent.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (dc *DailyContent) Value(name string) (ent.Value, error) {
|
||||
return dc.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryDaily queries the "daily" edge of the DailyContent entity.
|
||||
func (dc *DailyContent) QueryDaily() *DailyQuery {
|
||||
return NewDailyContentClient(dc.config).QueryDaily(dc)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this DailyContent.
|
||||
// Note that you need to call DailyContent.Unwrap() before calling this method if this DailyContent
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (dc *DailyContent) Update() *DailyContentUpdateOne {
|
||||
return NewDailyContentClient(dc.config).UpdateOne(dc)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the DailyContent 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 (dc *DailyContent) Unwrap() *DailyContent {
|
||||
_tx, ok := dc.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: DailyContent is not a transactional entity")
|
||||
}
|
||||
dc.config.driver = _tx.drv
|
||||
return dc
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (dc *DailyContent) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("DailyContent(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", dc.ID))
|
||||
builder.WriteString("language_code=")
|
||||
builder.WriteString(fmt.Sprintf("%v", dc.LanguageCode))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("quote=")
|
||||
builder.WriteString(dc.Quote)
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// DailyContents is a parsable slice of DailyContent.
|
||||
type DailyContents []*DailyContent
|
Loading…
Add table
Add a link
Reference in a new issue