Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
227
report.go8.9 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/report" "github.com/rs/xid" ) // Report is the model entity for the Report schema. type Report 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"` // The ID of the resource being reported. This is not a foreign key as reports can refer to a variety of sources, discriminated by the 'target_kind' field. TargetID xid.ID `json:"target_id,omitempty"` // The datagraph kind of resource being reported. TargetKind string `json:"target_kind,omitempty"` // ReportedByID holds the value of the "reported_by_id" field. ReportedByID xid.ID `json:"reported_by_id,omitempty"` // HandledByID holds the value of the "handled_by_id" field. HandledByID *xid.ID `json:"handled_by_id,omitempty"` // Comment holds the value of the "comment" field. Comment *string `json:"comment,omitempty"` // Reason holds the value of the "reason" field. Reason *string `json:"reason,omitempty"` // Status holds the value of the "status" field. Status string `json:"status,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the ReportQuery when eager-loading is set. Edges ReportEdges `json:"edges"` selectValues sql.SelectValues } // ReportEdges holds the relations/edges for other nodes in the graph. type ReportEdges struct { // ReportedBy holds the value of the reported_by edge. ReportedBy *Account `json:"reported_by,omitempty"` // HandledBy holds the value of the handled_by edge. HandledBy *Account `json:"handled_by,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [2]bool } // ReportedByOrErr returns the ReportedBy value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e ReportEdges) ReportedByOrErr() (*Account, error) { if e.ReportedBy != nil { return e.ReportedBy, nil } else if e.loadedTypes[0] { return nil, &NotFoundError{label: account.Label} } return nil, &NotLoadedError{edge: "reported_by"} } // HandledByOrErr returns the HandledBy value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e ReportEdges) HandledByOrErr() (*Account, error) { if e.HandledBy != nil { return e.HandledBy, nil } else if e.loadedTypes[1] { return nil, &NotFoundError{label: account.Label} } return nil, &NotLoadedError{edge: "handled_by"} } // scanValues returns the types for scanning values from sql.Rows. func (*Report) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case report.FieldHandledByID: values[i] = &sql.NullScanner{S: new(xid.ID)} case report.FieldTargetKind, report.FieldComment, report.FieldReason, report.FieldStatus: values[i] = new(sql.NullString) case report.FieldCreatedAt, report.FieldUpdatedAt: values[i] = new(sql.NullTime) case report.FieldID, report.FieldTargetID, report.FieldReportedByID: 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 Report fields. func (_m *Report) 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 report.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 report.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 report.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 report.FieldTargetID: if value, ok := values[i].(*xid.ID); !ok { return fmt.Errorf("unexpected type %T for field target_id", values[i]) } else if value != nil { _m.TargetID = *value } case report.FieldTargetKind: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field target_kind", values[i]) } else if value.Valid { _m.TargetKind = value.String } case report.FieldReportedByID: if value, ok := values[i].(*xid.ID); !ok { return fmt.Errorf("unexpected type %T for field reported_by_id", values[i]) } else if value != nil { _m.ReportedByID = *value } case report.FieldHandledByID: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field handled_by_id", values[i]) } else if value.Valid { _m.HandledByID = new(xid.ID) *_m.HandledByID = *value.S.(*xid.ID) } case report.FieldComment: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field comment", values[i]) } else if value.Valid { _m.Comment = new(string) *_m.Comment = value.String } case report.FieldReason: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field reason", values[i]) } else if value.Valid { _m.Reason = new(string) *_m.Reason = value.String } case report.FieldStatus: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field status", values[i]) } else if value.Valid { _m.Status = value.String } default: _m.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the Report. // This includes values selected through modifiers, order, etc. func (_m *Report) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // QueryReportedBy queries the "reported_by" edge of the Report entity. func (_m *Report) QueryReportedBy() *AccountQuery { return NewReportClient(_m.config).QueryReportedBy(_m) } // QueryHandledBy queries the "handled_by" edge of the Report entity. func (_m *Report) QueryHandledBy() *AccountQuery { return NewReportClient(_m.config).QueryHandledBy(_m) } // Update returns a builder for updating this Report. // Note that you need to call Report.Unwrap() before calling this method if this Report // was returned from a transaction, and the transaction was committed or rolled back. func (_m *Report) Update() *ReportUpdateOne { return NewReportClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Report 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 *Report) Unwrap() *Report { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Report is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *Report) String() string { var builder strings.Builder builder.WriteString("Report(") 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(", ") builder.WriteString("target_id=") builder.WriteString(fmt.Sprintf("%v", _m.TargetID)) builder.WriteString(", ") builder.WriteString("target_kind=") builder.WriteString(_m.TargetKind) builder.WriteString(", ") builder.WriteString("reported_by_id=") builder.WriteString(fmt.Sprintf("%v", _m.ReportedByID)) builder.WriteString(", ") if v := _m.HandledByID; v != nil { builder.WriteString("handled_by_id=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteString(", ") if v := _m.Comment; v != nil { builder.WriteString("comment=") builder.WriteString(*v) } builder.WriteString(", ") if v := _m.Reason; v != nil { builder.WriteString("reason=") builder.WriteString(*v) } builder.WriteString(", ") builder.WriteString("status=") builder.WriteString(_m.Status) builder.WriteByte(')') return builder.String() } // Reports is a parsable slice of Report. type Reports []*Report

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