Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
227
postread.go5.91 kB
// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "time" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/Southclaws/storyden/internal/ent/account" "github.com/Southclaws/storyden/internal/ent/post" "github.com/Southclaws/storyden/internal/ent/postread" "github.com/rs/xid" ) // PostRead is the model entity for the PostRead schema. type PostRead struct { config `json:"-"` // ID of the ent. ID xid.ID `json:"id,omitempty"` // RootPostID holds the value of the "root_post_id" field. RootPostID xid.ID `json:"root_post_id,omitempty"` // AccountID holds the value of the "account_id" field. AccountID xid.ID `json:"account_id,omitempty"` // LastSeenAt holds the value of the "last_seen_at" field. LastSeenAt time.Time `json:"last_seen_at,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the PostReadQuery when eager-loading is set. Edges PostReadEdges `json:"edges"` selectValues sql.SelectValues } // PostReadEdges holds the relations/edges for other nodes in the graph. type PostReadEdges struct { // RootPost holds the value of the root_post edge. RootPost *Post `json:"root_post,omitempty"` // Account holds the value of the account edge. Account *Account `json:"account,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [2]bool } // RootPostOrErr returns the RootPost value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e PostReadEdges) RootPostOrErr() (*Post, error) { if e.RootPost != nil { return e.RootPost, nil } else if e.loadedTypes[0] { return nil, &NotFoundError{label: post.Label} } return nil, &NotLoadedError{edge: "root_post"} } // AccountOrErr returns the Account value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e PostReadEdges) AccountOrErr() (*Account, error) { if e.Account != nil { return e.Account, nil } else if e.loadedTypes[1] { return nil, &NotFoundError{label: account.Label} } return nil, &NotLoadedError{edge: "account"} } // scanValues returns the types for scanning values from sql.Rows. func (*PostRead) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case postread.FieldLastSeenAt: values[i] = new(sql.NullTime) case postread.FieldID, postread.FieldRootPostID, postread.FieldAccountID: values[i] = new(xid.ID) default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the PostRead fields. func (_m *PostRead) 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 postread.FieldID: if value, ok := values[i].(*xid.ID); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value != nil { _m.ID = *value } case postread.FieldRootPostID: if value, ok := values[i].(*xid.ID); !ok { return fmt.Errorf("unexpected type %T for field root_post_id", values[i]) } else if value != nil { _m.RootPostID = *value } case postread.FieldAccountID: if value, ok := values[i].(*xid.ID); !ok { return fmt.Errorf("unexpected type %T for field account_id", values[i]) } else if value != nil { _m.AccountID = *value } case postread.FieldLastSeenAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field last_seen_at", values[i]) } else if value.Valid { _m.LastSeenAt = 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 PostRead. // This includes values selected through modifiers, order, etc. func (_m *PostRead) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // QueryRootPost queries the "root_post" edge of the PostRead entity. func (_m *PostRead) QueryRootPost() *PostQuery { return NewPostReadClient(_m.config).QueryRootPost(_m) } // QueryAccount queries the "account" edge of the PostRead entity. func (_m *PostRead) QueryAccount() *AccountQuery { return NewPostReadClient(_m.config).QueryAccount(_m) } // Update returns a builder for updating this PostRead. // Note that you need to call PostRead.Unwrap() before calling this method if this PostRead // was returned from a transaction, and the transaction was committed or rolled back. func (_m *PostRead) Update() *PostReadUpdateOne { return NewPostReadClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the PostRead 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 *PostRead) Unwrap() *PostRead { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: PostRead is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *PostRead) String() string { var builder strings.Builder builder.WriteString("PostRead(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("root_post_id=") builder.WriteString(fmt.Sprintf("%v", _m.RootPostID)) builder.WriteString(", ") builder.WriteString("account_id=") builder.WriteString(fmt.Sprintf("%v", _m.AccountID)) builder.WriteString(", ") builder.WriteString("last_seen_at=") builder.WriteString(_m.LastSeenAt.Format(time.ANSIC)) builder.WriteByte(')') return builder.String() } // PostReads is a parsable slice of PostRead. type PostReads []*PostRead

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server