Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
227
account.go22.7 kB
// Code generated by ent, DO NOT EDIT. package ent import ( "encoding/json" "fmt" "strings" "time" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/Southclaws/storyden/internal/ent/account" "github.com/Southclaws/storyden/internal/ent/invitation" "github.com/Southclaws/storyden/internal/ent/schema" "github.com/rs/xid" ) // Account is the model entity for the Account schema. type Account struct { config `json:"-"` // ID of the ent. ID xid.ID `json:"id,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"` // DeletedAt holds the value of the "deleted_at" field. DeletedAt *time.Time `json:"deleted_at,omitempty"` // IndexedAt holds the value of the "indexed_at" field. IndexedAt *time.Time `json:"indexed_at,omitempty"` // Handle holds the value of the "handle" field. Handle string `json:"handle,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Bio holds the value of the "bio" field. Bio string `json:"bio,omitempty"` // Kind holds the value of the "kind" field. Kind account.Kind `json:"kind,omitempty"` // Admin holds the value of the "admin" field. Admin bool `json:"admin,omitempty"` // Links holds the value of the "links" field. Links []schema.ExternalLink `json:"links,omitempty"` // Metadata holds the value of the "metadata" field. Metadata map[string]interface{} `json:"metadata,omitempty"` // InvitedByID holds the value of the "invited_by_id" field. InvitedByID *xid.ID `json:"invited_by_id,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the AccountQuery when eager-loading is set. Edges AccountEdges `json:"edges"` selectValues sql.SelectValues } // AccountEdges holds the relations/edges for other nodes in the graph. type AccountEdges struct { // Sessions holds the value of the sessions edge. Sessions []*Session `json:"sessions,omitempty"` // Emails holds the value of the emails edge. Emails []*Email `json:"emails,omitempty"` // Notifications holds the value of the notifications edge. Notifications []*Notification `json:"notifications,omitempty"` // TriggeredNotifications holds the value of the triggered_notifications edge. TriggeredNotifications []*Notification `json:"triggered_notifications,omitempty"` // Following holds the value of the following edge. Following []*AccountFollow `json:"following,omitempty"` // FollowedBy holds the value of the followed_by edge. FollowedBy []*AccountFollow `json:"followed_by,omitempty"` // Invitations holds the value of the invitations edge. Invitations []*Invitation `json:"invitations,omitempty"` // InvitedBy holds the value of the invited_by edge. InvitedBy *Invitation `json:"invited_by,omitempty"` // Posts holds the value of the posts edge. Posts []*Post `json:"posts,omitempty"` // Questions holds the value of the questions edge. Questions []*Question `json:"questions,omitempty"` // Reacts holds the value of the reacts edge. Reacts []*React `json:"reacts,omitempty"` // Likes holds the value of the likes edge. Likes []*LikePost `json:"likes,omitempty"` // Mentions holds the value of the mentions edge. Mentions []*MentionProfile `json:"mentions,omitempty"` // Roles holds the value of the roles edge. Roles []*Role `json:"roles,omitempty"` // Authentication holds the value of the authentication edge. Authentication []*Authentication `json:"authentication,omitempty"` // Tags holds the value of the tags edge. Tags []*Tag `json:"tags,omitempty"` // Collections holds the value of the collections edge. Collections []*Collection `json:"collections,omitempty"` // Nodes holds the value of the nodes edge. Nodes []*Node `json:"nodes,omitempty"` // Assets holds the value of the assets edge. Assets []*Asset `json:"assets,omitempty"` // Events holds the value of the events edge. Events []*EventParticipant `json:"events,omitempty"` // PostReads holds the value of the post_reads edge. PostReads []*PostRead `json:"post_reads,omitempty"` // Reports holds the value of the reports edge. Reports []*Report `json:"reports,omitempty"` // HandledReports holds the value of the handled_reports edge. HandledReports []*Report `json:"handled_reports,omitempty"` // AccountRoles holds the value of the account_roles edge. AccountRoles []*AccountRoles `json:"account_roles,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [24]bool } // SessionsOrErr returns the Sessions value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) SessionsOrErr() ([]*Session, error) { if e.loadedTypes[0] { return e.Sessions, nil } return nil, &NotLoadedError{edge: "sessions"} } // EmailsOrErr returns the Emails value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) EmailsOrErr() ([]*Email, error) { if e.loadedTypes[1] { return e.Emails, nil } return nil, &NotLoadedError{edge: "emails"} } // NotificationsOrErr returns the Notifications value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) NotificationsOrErr() ([]*Notification, error) { if e.loadedTypes[2] { return e.Notifications, nil } return nil, &NotLoadedError{edge: "notifications"} } // TriggeredNotificationsOrErr returns the TriggeredNotifications value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) TriggeredNotificationsOrErr() ([]*Notification, error) { if e.loadedTypes[3] { return e.TriggeredNotifications, nil } return nil, &NotLoadedError{edge: "triggered_notifications"} } // FollowingOrErr returns the Following value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) FollowingOrErr() ([]*AccountFollow, error) { if e.loadedTypes[4] { return e.Following, nil } return nil, &NotLoadedError{edge: "following"} } // FollowedByOrErr returns the FollowedBy value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) FollowedByOrErr() ([]*AccountFollow, error) { if e.loadedTypes[5] { return e.FollowedBy, nil } return nil, &NotLoadedError{edge: "followed_by"} } // InvitationsOrErr returns the Invitations value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) InvitationsOrErr() ([]*Invitation, error) { if e.loadedTypes[6] { return e.Invitations, nil } return nil, &NotLoadedError{edge: "invitations"} } // InvitedByOrErr returns the InvitedBy value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e AccountEdges) InvitedByOrErr() (*Invitation, error) { if e.InvitedBy != nil { return e.InvitedBy, nil } else if e.loadedTypes[7] { return nil, &NotFoundError{label: invitation.Label} } return nil, &NotLoadedError{edge: "invited_by"} } // PostsOrErr returns the Posts value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) PostsOrErr() ([]*Post, error) { if e.loadedTypes[8] { return e.Posts, nil } return nil, &NotLoadedError{edge: "posts"} } // QuestionsOrErr returns the Questions value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) QuestionsOrErr() ([]*Question, error) { if e.loadedTypes[9] { return e.Questions, nil } return nil, &NotLoadedError{edge: "questions"} } // ReactsOrErr returns the Reacts value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) ReactsOrErr() ([]*React, error) { if e.loadedTypes[10] { return e.Reacts, nil } return nil, &NotLoadedError{edge: "reacts"} } // LikesOrErr returns the Likes value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) LikesOrErr() ([]*LikePost, error) { if e.loadedTypes[11] { return e.Likes, nil } return nil, &NotLoadedError{edge: "likes"} } // MentionsOrErr returns the Mentions value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) MentionsOrErr() ([]*MentionProfile, error) { if e.loadedTypes[12] { return e.Mentions, nil } return nil, &NotLoadedError{edge: "mentions"} } // RolesOrErr returns the Roles value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) RolesOrErr() ([]*Role, error) { if e.loadedTypes[13] { return e.Roles, nil } return nil, &NotLoadedError{edge: "roles"} } // AuthenticationOrErr returns the Authentication value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) AuthenticationOrErr() ([]*Authentication, error) { if e.loadedTypes[14] { return e.Authentication, nil } return nil, &NotLoadedError{edge: "authentication"} } // TagsOrErr returns the Tags value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) TagsOrErr() ([]*Tag, error) { if e.loadedTypes[15] { return e.Tags, nil } return nil, &NotLoadedError{edge: "tags"} } // CollectionsOrErr returns the Collections value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) CollectionsOrErr() ([]*Collection, error) { if e.loadedTypes[16] { return e.Collections, nil } return nil, &NotLoadedError{edge: "collections"} } // NodesOrErr returns the Nodes value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) NodesOrErr() ([]*Node, error) { if e.loadedTypes[17] { return e.Nodes, nil } return nil, &NotLoadedError{edge: "nodes"} } // AssetsOrErr returns the Assets value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) AssetsOrErr() ([]*Asset, error) { if e.loadedTypes[18] { return e.Assets, nil } return nil, &NotLoadedError{edge: "assets"} } // EventsOrErr returns the Events value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) EventsOrErr() ([]*EventParticipant, error) { if e.loadedTypes[19] { return e.Events, nil } return nil, &NotLoadedError{edge: "events"} } // PostReadsOrErr returns the PostReads value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) PostReadsOrErr() ([]*PostRead, error) { if e.loadedTypes[20] { return e.PostReads, nil } return nil, &NotLoadedError{edge: "post_reads"} } // ReportsOrErr returns the Reports value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) ReportsOrErr() ([]*Report, error) { if e.loadedTypes[21] { return e.Reports, nil } return nil, &NotLoadedError{edge: "reports"} } // HandledReportsOrErr returns the HandledReports value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) HandledReportsOrErr() ([]*Report, error) { if e.loadedTypes[22] { return e.HandledReports, nil } return nil, &NotLoadedError{edge: "handled_reports"} } // AccountRolesOrErr returns the AccountRoles value or an error if the edge // was not loaded in eager-loading. func (e AccountEdges) AccountRolesOrErr() ([]*AccountRoles, error) { if e.loadedTypes[23] { return e.AccountRoles, nil } return nil, &NotLoadedError{edge: "account_roles"} } // scanValues returns the types for scanning values from sql.Rows. func (*Account) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case account.FieldInvitedByID: values[i] = &sql.NullScanner{S: new(xid.ID)} case account.FieldLinks, account.FieldMetadata: values[i] = new([]byte) case account.FieldAdmin: values[i] = new(sql.NullBool) case account.FieldHandle, account.FieldName, account.FieldBio, account.FieldKind: values[i] = new(sql.NullString) case account.FieldCreatedAt, account.FieldUpdatedAt, account.FieldDeletedAt, account.FieldIndexedAt: values[i] = new(sql.NullTime) case account.FieldID: 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 Account fields. func (_m *Account) 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 account.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 account.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 { _m.CreatedAt = value.Time } case account.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 { _m.UpdatedAt = value.Time } case account.FieldDeletedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field deleted_at", values[i]) } else if value.Valid { _m.DeletedAt = new(time.Time) *_m.DeletedAt = value.Time } case account.FieldIndexedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field indexed_at", values[i]) } else if value.Valid { _m.IndexedAt = new(time.Time) *_m.IndexedAt = value.Time } case account.FieldHandle: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field handle", values[i]) } else if value.Valid { _m.Handle = value.String } case account.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) } else if value.Valid { _m.Name = value.String } case account.FieldBio: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field bio", values[i]) } else if value.Valid { _m.Bio = value.String } case account.FieldKind: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field kind", values[i]) } else if value.Valid { _m.Kind = account.Kind(value.String) } case account.FieldAdmin: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field admin", values[i]) } else if value.Valid { _m.Admin = value.Bool } case account.FieldLinks: if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field links", values[i]) } else if value != nil && len(*value) > 0 { if err := json.Unmarshal(*value, &_m.Links); err != nil { return fmt.Errorf("unmarshal field links: %w", err) } } case account.FieldMetadata: if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field metadata", values[i]) } else if value != nil && len(*value) > 0 { if err := json.Unmarshal(*value, &_m.Metadata); err != nil { return fmt.Errorf("unmarshal field metadata: %w", err) } } case account.FieldInvitedByID: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field invited_by_id", values[i]) } else if value.Valid { _m.InvitedByID = new(xid.ID) *_m.InvitedByID = *value.S.(*xid.ID) } default: _m.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the Account. // This includes values selected through modifiers, order, etc. func (_m *Account) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // QuerySessions queries the "sessions" edge of the Account entity. func (_m *Account) QuerySessions() *SessionQuery { return NewAccountClient(_m.config).QuerySessions(_m) } // QueryEmails queries the "emails" edge of the Account entity. func (_m *Account) QueryEmails() *EmailQuery { return NewAccountClient(_m.config).QueryEmails(_m) } // QueryNotifications queries the "notifications" edge of the Account entity. func (_m *Account) QueryNotifications() *NotificationQuery { return NewAccountClient(_m.config).QueryNotifications(_m) } // QueryTriggeredNotifications queries the "triggered_notifications" edge of the Account entity. func (_m *Account) QueryTriggeredNotifications() *NotificationQuery { return NewAccountClient(_m.config).QueryTriggeredNotifications(_m) } // QueryFollowing queries the "following" edge of the Account entity. func (_m *Account) QueryFollowing() *AccountFollowQuery { return NewAccountClient(_m.config).QueryFollowing(_m) } // QueryFollowedBy queries the "followed_by" edge of the Account entity. func (_m *Account) QueryFollowedBy() *AccountFollowQuery { return NewAccountClient(_m.config).QueryFollowedBy(_m) } // QueryInvitations queries the "invitations" edge of the Account entity. func (_m *Account) QueryInvitations() *InvitationQuery { return NewAccountClient(_m.config).QueryInvitations(_m) } // QueryInvitedBy queries the "invited_by" edge of the Account entity. func (_m *Account) QueryInvitedBy() *InvitationQuery { return NewAccountClient(_m.config).QueryInvitedBy(_m) } // QueryPosts queries the "posts" edge of the Account entity. func (_m *Account) QueryPosts() *PostQuery { return NewAccountClient(_m.config).QueryPosts(_m) } // QueryQuestions queries the "questions" edge of the Account entity. func (_m *Account) QueryQuestions() *QuestionQuery { return NewAccountClient(_m.config).QueryQuestions(_m) } // QueryReacts queries the "reacts" edge of the Account entity. func (_m *Account) QueryReacts() *ReactQuery { return NewAccountClient(_m.config).QueryReacts(_m) } // QueryLikes queries the "likes" edge of the Account entity. func (_m *Account) QueryLikes() *LikePostQuery { return NewAccountClient(_m.config).QueryLikes(_m) } // QueryMentions queries the "mentions" edge of the Account entity. func (_m *Account) QueryMentions() *MentionProfileQuery { return NewAccountClient(_m.config).QueryMentions(_m) } // QueryRoles queries the "roles" edge of the Account entity. func (_m *Account) QueryRoles() *RoleQuery { return NewAccountClient(_m.config).QueryRoles(_m) } // QueryAuthentication queries the "authentication" edge of the Account entity. func (_m *Account) QueryAuthentication() *AuthenticationQuery { return NewAccountClient(_m.config).QueryAuthentication(_m) } // QueryTags queries the "tags" edge of the Account entity. func (_m *Account) QueryTags() *TagQuery { return NewAccountClient(_m.config).QueryTags(_m) } // QueryCollections queries the "collections" edge of the Account entity. func (_m *Account) QueryCollections() *CollectionQuery { return NewAccountClient(_m.config).QueryCollections(_m) } // QueryNodes queries the "nodes" edge of the Account entity. func (_m *Account) QueryNodes() *NodeQuery { return NewAccountClient(_m.config).QueryNodes(_m) } // QueryAssets queries the "assets" edge of the Account entity. func (_m *Account) QueryAssets() *AssetQuery { return NewAccountClient(_m.config).QueryAssets(_m) } // QueryEvents queries the "events" edge of the Account entity. func (_m *Account) QueryEvents() *EventParticipantQuery { return NewAccountClient(_m.config).QueryEvents(_m) } // QueryPostReads queries the "post_reads" edge of the Account entity. func (_m *Account) QueryPostReads() *PostReadQuery { return NewAccountClient(_m.config).QueryPostReads(_m) } // QueryReports queries the "reports" edge of the Account entity. func (_m *Account) QueryReports() *ReportQuery { return NewAccountClient(_m.config).QueryReports(_m) } // QueryHandledReports queries the "handled_reports" edge of the Account entity. func (_m *Account) QueryHandledReports() *ReportQuery { return NewAccountClient(_m.config).QueryHandledReports(_m) } // QueryAccountRoles queries the "account_roles" edge of the Account entity. func (_m *Account) QueryAccountRoles() *AccountRolesQuery { return NewAccountClient(_m.config).QueryAccountRoles(_m) } // Update returns a builder for updating this Account. // Note that you need to call Account.Unwrap() before calling this method if this Account // was returned from a transaction, and the transaction was committed or rolled back. func (_m *Account) Update() *AccountUpdateOne { return NewAccountClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Account 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 *Account) Unwrap() *Account { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Account is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *Account) String() string { var builder strings.Builder builder.WriteString("Account(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("created_at=") builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") if v := _m.DeletedAt; v != nil { builder.WriteString("deleted_at=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") if v := _m.IndexedAt; v != nil { builder.WriteString("indexed_at=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") builder.WriteString("handle=") builder.WriteString(_m.Handle) builder.WriteString(", ") builder.WriteString("name=") builder.WriteString(_m.Name) builder.WriteString(", ") builder.WriteString("bio=") builder.WriteString(_m.Bio) builder.WriteString(", ") builder.WriteString("kind=") builder.WriteString(fmt.Sprintf("%v", _m.Kind)) builder.WriteString(", ") builder.WriteString("admin=") builder.WriteString(fmt.Sprintf("%v", _m.Admin)) builder.WriteString(", ") builder.WriteString("links=") builder.WriteString(fmt.Sprintf("%v", _m.Links)) builder.WriteString(", ") builder.WriteString("metadata=") builder.WriteString(fmt.Sprintf("%v", _m.Metadata)) builder.WriteString(", ") if v := _m.InvitedByID; v != nil { builder.WriteString("invited_by_id=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteByte(')') return builder.String() } // Accounts is a parsable slice of Account. type Accounts []*Account

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