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