[feature] migrate to monorepo
This commit is contained in:
commit
05ddc1f783
267 changed files with 75165 additions and 0 deletions
217
backend/ent/postcontributor.go
Normal file
217
backend/ent/postcontributor.go
Normal file
|
@ -0,0 +1,217 @@
|
|||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
"tss-rocks-be/ent/contributor"
|
||||
"tss-rocks-be/ent/contributorrole"
|
||||
"tss-rocks-be/ent/post"
|
||||
"tss-rocks-be/ent/postcontributor"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// PostContributor is the model entity for the PostContributor schema.
|
||||
type PostContributor struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
// LanguageCode holds the value of the "language_code" field.
|
||||
LanguageCode *postcontributor.LanguageCode `json:"language_code,omitempty"`
|
||||
// CreatedAt holds the value of the "created_at" field.
|
||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the PostContributorQuery when eager-loading is set.
|
||||
Edges PostContributorEdges `json:"edges"`
|
||||
contributor_posts *int
|
||||
contributor_role_post_contributors *int
|
||||
post_contributors *int
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// PostContributorEdges holds the relations/edges for other nodes in the graph.
|
||||
type PostContributorEdges struct {
|
||||
// Post holds the value of the post edge.
|
||||
Post *Post `json:"post,omitempty"`
|
||||
// Contributor holds the value of the contributor edge.
|
||||
Contributor *Contributor `json:"contributor,omitempty"`
|
||||
// Role holds the value of the role edge.
|
||||
Role *ContributorRole `json:"role,omitempty"`
|
||||
// loadedTypes holds the information for reporting if a
|
||||
// type was loaded (or requested) in eager-loading or not.
|
||||
loadedTypes [3]bool
|
||||
}
|
||||
|
||||
// PostOrErr returns the Post value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e PostContributorEdges) PostOrErr() (*Post, error) {
|
||||
if e.Post != nil {
|
||||
return e.Post, nil
|
||||
} else if e.loadedTypes[0] {
|
||||
return nil, &NotFoundError{label: post.Label}
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "post"}
|
||||
}
|
||||
|
||||
// ContributorOrErr returns the Contributor value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e PostContributorEdges) ContributorOrErr() (*Contributor, error) {
|
||||
if e.Contributor != nil {
|
||||
return e.Contributor, nil
|
||||
} else if e.loadedTypes[1] {
|
||||
return nil, &NotFoundError{label: contributor.Label}
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "contributor"}
|
||||
}
|
||||
|
||||
// RoleOrErr returns the Role value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e PostContributorEdges) RoleOrErr() (*ContributorRole, error) {
|
||||
if e.Role != nil {
|
||||
return e.Role, nil
|
||||
} else if e.loadedTypes[2] {
|
||||
return nil, &NotFoundError{label: contributorrole.Label}
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "role"}
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*PostContributor) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case postcontributor.FieldID:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case postcontributor.FieldLanguageCode:
|
||||
values[i] = new(sql.NullString)
|
||||
case postcontributor.FieldCreatedAt:
|
||||
values[i] = new(sql.NullTime)
|
||||
case postcontributor.ForeignKeys[0]: // contributor_posts
|
||||
values[i] = new(sql.NullInt64)
|
||||
case postcontributor.ForeignKeys[1]: // contributor_role_post_contributors
|
||||
values[i] = new(sql.NullInt64)
|
||||
case postcontributor.ForeignKeys[2]: // post_contributors
|
||||
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 PostContributor fields.
|
||||
func (pc *PostContributor) 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 postcontributor.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
pc.ID = int(value.Int64)
|
||||
case postcontributor.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 {
|
||||
pc.LanguageCode = new(postcontributor.LanguageCode)
|
||||
*pc.LanguageCode = postcontributor.LanguageCode(value.String)
|
||||
}
|
||||
case postcontributor.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 {
|
||||
pc.CreatedAt = value.Time
|
||||
}
|
||||
case postcontributor.ForeignKeys[0]:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for edge-field contributor_posts", value)
|
||||
} else if value.Valid {
|
||||
pc.contributor_posts = new(int)
|
||||
*pc.contributor_posts = int(value.Int64)
|
||||
}
|
||||
case postcontributor.ForeignKeys[1]:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for edge-field contributor_role_post_contributors", value)
|
||||
} else if value.Valid {
|
||||
pc.contributor_role_post_contributors = new(int)
|
||||
*pc.contributor_role_post_contributors = int(value.Int64)
|
||||
}
|
||||
case postcontributor.ForeignKeys[2]:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for edge-field post_contributors", value)
|
||||
} else if value.Valid {
|
||||
pc.post_contributors = new(int)
|
||||
*pc.post_contributors = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
pc.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the PostContributor.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (pc *PostContributor) Value(name string) (ent.Value, error) {
|
||||
return pc.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryPost queries the "post" edge of the PostContributor entity.
|
||||
func (pc *PostContributor) QueryPost() *PostQuery {
|
||||
return NewPostContributorClient(pc.config).QueryPost(pc)
|
||||
}
|
||||
|
||||
// QueryContributor queries the "contributor" edge of the PostContributor entity.
|
||||
func (pc *PostContributor) QueryContributor() *ContributorQuery {
|
||||
return NewPostContributorClient(pc.config).QueryContributor(pc)
|
||||
}
|
||||
|
||||
// QueryRole queries the "role" edge of the PostContributor entity.
|
||||
func (pc *PostContributor) QueryRole() *ContributorRoleQuery {
|
||||
return NewPostContributorClient(pc.config).QueryRole(pc)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this PostContributor.
|
||||
// Note that you need to call PostContributor.Unwrap() before calling this method if this PostContributor
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (pc *PostContributor) Update() *PostContributorUpdateOne {
|
||||
return NewPostContributorClient(pc.config).UpdateOne(pc)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the PostContributor 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 (pc *PostContributor) Unwrap() *PostContributor {
|
||||
_tx, ok := pc.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: PostContributor is not a transactional entity")
|
||||
}
|
||||
pc.config.driver = _tx.drv
|
||||
return pc
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (pc *PostContributor) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("PostContributor(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", pc.ID))
|
||||
if v := pc.LanguageCode; v != nil {
|
||||
builder.WriteString("language_code=")
|
||||
builder.WriteString(fmt.Sprintf("%v", *v))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("created_at=")
|
||||
builder.WriteString(pc.CreatedAt.Format(time.ANSIC))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// PostContributors is a parsable slice of PostContributor.
|
||||
type PostContributors []*PostContributor
|
Loading…
Add table
Add a link
Reference in a new issue