Update new storage types and regenerate
This commit is contained in:
parent
0932f19f71
commit
41e432b56e
28 changed files with 6561 additions and 23 deletions
|
@ -44,6 +44,72 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
RelationField: field.NewRelation("AttachmentRelations", "models.NoteToAttachment"),
|
||||
Note: struct {
|
||||
field.RelationField
|
||||
Creator struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
}
|
||||
|
@ -59,6 +125,9 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +148,209 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note", "models.Note"),
|
||||
Creator: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
|
@ -96,6 +368,9 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}{
|
||||
|
@ -112,6 +387,9 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.EmoteRelations.Emote", "models.Emote"),
|
||||
|
@ -122,8 +400,16 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
},
|
||||
Server: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.EmoteRelations.Emote.Server.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -187,6 +473,12 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
RelationField: field.NewRelation("Tags", "models.NoteTag"),
|
||||
}
|
||||
|
||||
_note.Creator = noteBelongsToCreator{
|
||||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("Creator", "models.User"),
|
||||
}
|
||||
|
||||
_note.fillFieldMap()
|
||||
|
||||
return _note
|
||||
|
@ -216,6 +508,8 @@ type note struct {
|
|||
|
||||
Tags noteHasManyTags
|
||||
|
||||
Creator noteBelongsToCreator
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
|
@ -259,7 +553,7 @@ func (n *note) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|||
}
|
||||
|
||||
func (n *note) fillFieldMap() {
|
||||
n.fieldMap = make(map[string]field.Expr, 16)
|
||||
n.fieldMap = make(map[string]field.Expr, 17)
|
||||
n.fieldMap["id"] = n.ID
|
||||
n.fieldMap["created_at"] = n.CreatedAt
|
||||
n.fieldMap["updated_at"] = n.UpdatedAt
|
||||
|
@ -292,6 +586,72 @@ type noteHasManyAttachmentRelations struct {
|
|||
|
||||
Note struct {
|
||||
field.RelationField
|
||||
Creator struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
}
|
||||
|
@ -307,6 +667,9 @@ type noteHasManyAttachmentRelations struct {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -609,6 +972,77 @@ func (a noteHasManyTagsTx) Count() int64 {
|
|||
return a.tx.Count()
|
||||
}
|
||||
|
||||
type noteBelongsToCreator struct {
|
||||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreator) Where(conds ...field.Expr) *noteBelongsToCreator {
|
||||
if len(conds) == 0 {
|
||||
return &a
|
||||
}
|
||||
|
||||
exprs := make([]clause.Expression, 0, len(conds))
|
||||
for _, cond := range conds {
|
||||
exprs = append(exprs, cond.BeCond().(clause.Expression))
|
||||
}
|
||||
a.db = a.db.Clauses(clause.Where{Exprs: exprs})
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreator) WithContext(ctx context.Context) *noteBelongsToCreator {
|
||||
a.db = a.db.WithContext(ctx)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreator) Session(session *gorm.Session) *noteBelongsToCreator {
|
||||
a.db = a.db.Session(session)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreator) Model(m *models.Note) *noteBelongsToCreatorTx {
|
||||
return ¬eBelongsToCreatorTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
type noteBelongsToCreatorTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a noteBelongsToCreatorTx) Find() (result *models.User, err error) {
|
||||
return result, a.tx.Find(&result)
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreatorTx) Append(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Append(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreatorTx) Replace(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Replace(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreatorTx) Delete(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Delete(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreatorTx) Clear() error {
|
||||
return a.tx.Clear()
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreatorTx) Count() int64 {
|
||||
return a.tx.Count()
|
||||
}
|
||||
|
||||
type noteDo struct{ gen.DO }
|
||||
|
||||
type INoteDo interface {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue