ka/ent/gql_mutation_input.go

302 lines
6.8 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"time"
"github.com/google/uuid"
)
// CreateCategoryInput represents a mutation input for creating categories.
type CreateCategoryInput struct {
CreatedAt *time.Time
UpdatedAt *time.Time
Title string
Description *string
PostIDs []uuid.UUID
}
// Mutate applies the CreateCategoryInput on the CategoryMutation builder.
func (i *CreateCategoryInput) Mutate(m *CategoryMutation) {
if v := i.CreatedAt; v != nil {
m.SetCreatedAt(*v)
}
if v := i.UpdatedAt; v != nil {
m.SetUpdatedAt(*v)
}
m.SetTitle(i.Title)
if v := i.Description; v != nil {
m.SetDescription(*v)
}
if v := i.PostIDs; len(v) > 0 {
m.AddPostIDs(v...)
}
}
// SetInput applies the change-set in the CreateCategoryInput on the CategoryCreate builder.
func (c *CategoryCreate) SetInput(i CreateCategoryInput) *CategoryCreate {
i.Mutate(c.Mutation())
return c
}
// UpdateCategoryInput represents a mutation input for updating categories.
type UpdateCategoryInput struct {
ClearUpdatedAt bool
UpdatedAt *time.Time
Title *string
ClearDescription bool
Description *string
ClearPosts bool
AddPostIDs []uuid.UUID
RemovePostIDs []uuid.UUID
}
// Mutate applies the UpdateCategoryInput on the CategoryMutation builder.
func (i *UpdateCategoryInput) Mutate(m *CategoryMutation) {
if i.ClearUpdatedAt {
m.ClearUpdatedAt()
}
if v := i.UpdatedAt; v != nil {
m.SetUpdatedAt(*v)
}
if v := i.Title; v != nil {
m.SetTitle(*v)
}
if i.ClearDescription {
m.ClearDescription()
}
if v := i.Description; v != nil {
m.SetDescription(*v)
}
if i.ClearPosts {
m.ClearPosts()
}
if v := i.AddPostIDs; len(v) > 0 {
m.AddPostIDs(v...)
}
if v := i.RemovePostIDs; len(v) > 0 {
m.RemovePostIDs(v...)
}
}
// SetInput applies the change-set in the UpdateCategoryInput on the CategoryUpdate builder.
func (c *CategoryUpdate) SetInput(i UpdateCategoryInput) *CategoryUpdate {
i.Mutate(c.Mutation())
return c
}
// SetInput applies the change-set in the UpdateCategoryInput on the CategoryUpdateOne builder.
func (c *CategoryUpdateOne) SetInput(i UpdateCategoryInput) *CategoryUpdateOne {
i.Mutate(c.Mutation())
return c
}
// CreatePostInput represents a mutation input for creating posts.
type CreatePostInput struct {
CreatedAt *time.Time
UpdatedAt *time.Time
Expires *bool
ExpireTime *time.Time
Title string
Body string
CategoryID *uuid.UUID
ProfileID *uuid.UUID
}
// Mutate applies the CreatePostInput on the PostMutation builder.
func (i *CreatePostInput) Mutate(m *PostMutation) {
if v := i.CreatedAt; v != nil {
m.SetCreatedAt(*v)
}
if v := i.UpdatedAt; v != nil {
m.SetUpdatedAt(*v)
}
if v := i.Expires; v != nil {
m.SetExpires(*v)
}
if v := i.ExpireTime; v != nil {
m.SetExpireTime(*v)
}
m.SetTitle(i.Title)
m.SetBody(i.Body)
if v := i.CategoryID; v != nil {
m.SetCategoryID(*v)
}
if v := i.ProfileID; v != nil {
m.SetProfileID(*v)
}
}
// SetInput applies the change-set in the CreatePostInput on the PostCreate builder.
func (c *PostCreate) SetInput(i CreatePostInput) *PostCreate {
i.Mutate(c.Mutation())
return c
}
// UpdatePostInput represents a mutation input for updating posts.
type UpdatePostInput struct {
ClearUpdatedAt bool
UpdatedAt *time.Time
Expires *bool
ClearExpireTime bool
ExpireTime *time.Time
Title *string
Body *string
ClearCategory bool
CategoryID *uuid.UUID
ClearProfile bool
ProfileID *uuid.UUID
}
// Mutate applies the UpdatePostInput on the PostMutation builder.
func (i *UpdatePostInput) Mutate(m *PostMutation) {
if i.ClearUpdatedAt {
m.ClearUpdatedAt()
}
if v := i.UpdatedAt; v != nil {
m.SetUpdatedAt(*v)
}
if v := i.Expires; v != nil {
m.SetExpires(*v)
}
if i.ClearExpireTime {
m.ClearExpireTime()
}
if v := i.ExpireTime; v != nil {
m.SetExpireTime(*v)
}
if v := i.Title; v != nil {
m.SetTitle(*v)
}
if v := i.Body; v != nil {
m.SetBody(*v)
}
if i.ClearCategory {
m.ClearCategory()
}
if v := i.CategoryID; v != nil {
m.SetCategoryID(*v)
}
if i.ClearProfile {
m.ClearProfile()
}
if v := i.ProfileID; v != nil {
m.SetProfileID(*v)
}
}
// SetInput applies the change-set in the UpdatePostInput on the PostUpdate builder.
func (c *PostUpdate) SetInput(i UpdatePostInput) *PostUpdate {
i.Mutate(c.Mutation())
return c
}
// SetInput applies the change-set in the UpdatePostInput on the PostUpdateOne builder.
func (c *PostUpdateOne) SetInput(i UpdatePostInput) *PostUpdateOne {
i.Mutate(c.Mutation())
return c
}
// CreateProfileInput represents a mutation input for creating profiles.
type CreateProfileInput struct {
CreatedAt *time.Time
UpdatedAt *time.Time
Name *string
Address *string
Phone *string
PostIDs []uuid.UUID
}
// Mutate applies the CreateProfileInput on the ProfileMutation builder.
func (i *CreateProfileInput) Mutate(m *ProfileMutation) {
if v := i.CreatedAt; v != nil {
m.SetCreatedAt(*v)
}
if v := i.UpdatedAt; v != nil {
m.SetUpdatedAt(*v)
}
if v := i.Name; v != nil {
m.SetName(*v)
}
if v := i.Address; v != nil {
m.SetAddress(*v)
}
if v := i.Phone; v != nil {
m.SetPhone(*v)
}
if v := i.PostIDs; len(v) > 0 {
m.AddPostIDs(v...)
}
}
// SetInput applies the change-set in the CreateProfileInput on the ProfileCreate builder.
func (c *ProfileCreate) SetInput(i CreateProfileInput) *ProfileCreate {
i.Mutate(c.Mutation())
return c
}
// UpdateProfileInput represents a mutation input for updating profiles.
type UpdateProfileInput struct {
ClearUpdatedAt bool
UpdatedAt *time.Time
ClearName bool
Name *string
ClearAddress bool
Address *string
ClearPhone bool
Phone *string
ClearPosts bool
AddPostIDs []uuid.UUID
RemovePostIDs []uuid.UUID
}
// Mutate applies the UpdateProfileInput on the ProfileMutation builder.
func (i *UpdateProfileInput) Mutate(m *ProfileMutation) {
if i.ClearUpdatedAt {
m.ClearUpdatedAt()
}
if v := i.UpdatedAt; v != nil {
m.SetUpdatedAt(*v)
}
if i.ClearName {
m.ClearName()
}
if v := i.Name; v != nil {
m.SetName(*v)
}
if i.ClearAddress {
m.ClearAddress()
}
if v := i.Address; v != nil {
m.SetAddress(*v)
}
if i.ClearPhone {
m.ClearPhone()
}
if v := i.Phone; v != nil {
m.SetPhone(*v)
}
if i.ClearPosts {
m.ClearPosts()
}
if v := i.AddPostIDs; len(v) > 0 {
m.AddPostIDs(v...)
}
if v := i.RemovePostIDs; len(v) > 0 {
m.RemovePostIDs(v...)
}
}
// SetInput applies the change-set in the UpdateProfileInput on the ProfileUpdate builder.
func (c *ProfileUpdate) SetInput(i UpdateProfileInput) *ProfileUpdate {
i.Mutate(c.Mutation())
return c
}
// SetInput applies the change-set in the UpdateProfileInput on the ProfileUpdateOne builder.
func (c *ProfileUpdateOne) SetInput(i UpdateProfileInput) *ProfileUpdateOne {
i.Mutate(c.Mutation())
return c
}