Work on AS activities and objects
All checks were successful
/ docker (push) Successful in 4m15s

This commit is contained in:
Melody Becker 2025-04-29 21:35:58 +02:00
parent d32818af09
commit cfa0566c6d
Signed by: mstar
SSH key fingerprint: SHA256:vkXfS9FG2pVNVfvDrzd1VW9n8VJzqqdKQGljxxX8uK8
39 changed files with 2276 additions and 183 deletions

View file

@ -6,6 +6,7 @@ package dbgen
import (
"context"
"database/sql"
"strings"
"git.mstar.dev/mstar/linstrom/storage-new/models"
@ -321,6 +322,19 @@ func newNotification(db *gorm.DB, opts ...gen.DOOption) notification {
RelationField: field.NewRelation("SourceNote.Tags.Note", "models.Note"),
},
},
Edits: struct {
field.RelationField
Note struct {
field.RelationField
}
}{
RelationField: field.NewRelation("SourceNote.Edits", "models.NoteEdit"),
Note: struct {
field.RelationField
}{
RelationField: field.NewRelation("SourceNote.Edits.Note", "models.Note"),
},
},
}
_notification.SourceUser = notificationBelongsToSourceUser{
@ -408,11 +422,20 @@ func (n *notification) fillFieldMap() {
func (n notification) clone(db *gorm.DB) notification {
n.notificationDo.ReplaceConnPool(db.Statement.ConnPool)
n.ForUser.db = db.Session(&gorm.Session{Initialized: true})
n.ForUser.db.Statement.ConnPool = db.Statement.ConnPool
n.SourceNote.db = db.Session(&gorm.Session{Initialized: true})
n.SourceNote.db.Statement.ConnPool = db.Statement.ConnPool
n.SourceUser.db = db.Session(&gorm.Session{Initialized: true})
n.SourceUser.db.Statement.ConnPool = db.Statement.ConnPool
return n
}
func (n notification) replaceDB(db *gorm.DB) notification {
n.notificationDo.ReplaceDB(db)
n.ForUser.db = db.Session(&gorm.Session{})
n.SourceNote.db = db.Session(&gorm.Session{})
n.SourceUser.db = db.Session(&gorm.Session{})
return n
}
@ -525,6 +548,11 @@ func (a notificationBelongsToForUser) Model(m *models.Notification) *notificatio
return &notificationBelongsToForUserTx{a.db.Model(m).Association(a.Name())}
}
func (a notificationBelongsToForUser) Unscoped() *notificationBelongsToForUser {
a.db = a.db.Unscoped()
return &a
}
type notificationBelongsToForUserTx struct{ tx *gorm.Association }
func (a notificationBelongsToForUserTx) Find() (result *models.User, err error) {
@ -563,6 +591,11 @@ func (a notificationBelongsToForUserTx) Count() int64 {
return a.tx.Count()
}
func (a notificationBelongsToForUserTx) Unscoped() *notificationBelongsToForUserTx {
a.tx = a.tx.Unscoped()
return &a
}
type notificationBelongsToSourceNote struct {
db *gorm.DB
@ -613,6 +646,12 @@ type notificationBelongsToSourceNote struct {
field.RelationField
}
}
Edits struct {
field.RelationField
Note struct {
field.RelationField
}
}
}
func (a notificationBelongsToSourceNote) Where(conds ...field.Expr) *notificationBelongsToSourceNote {
@ -642,6 +681,11 @@ func (a notificationBelongsToSourceNote) Model(m *models.Notification) *notifica
return &notificationBelongsToSourceNoteTx{a.db.Model(m).Association(a.Name())}
}
func (a notificationBelongsToSourceNote) Unscoped() *notificationBelongsToSourceNote {
a.db = a.db.Unscoped()
return &a
}
type notificationBelongsToSourceNoteTx struct{ tx *gorm.Association }
func (a notificationBelongsToSourceNoteTx) Find() (result *models.Note, err error) {
@ -680,6 +724,11 @@ func (a notificationBelongsToSourceNoteTx) Count() int64 {
return a.tx.Count()
}
func (a notificationBelongsToSourceNoteTx) Unscoped() *notificationBelongsToSourceNoteTx {
a.tx = a.tx.Unscoped()
return &a
}
type notificationBelongsToSourceUser struct {
db *gorm.DB
@ -713,6 +762,11 @@ func (a notificationBelongsToSourceUser) Model(m *models.Notification) *notifica
return &notificationBelongsToSourceUserTx{a.db.Model(m).Association(a.Name())}
}
func (a notificationBelongsToSourceUser) Unscoped() *notificationBelongsToSourceUser {
a.db = a.db.Unscoped()
return &a
}
type notificationBelongsToSourceUserTx struct{ tx *gorm.Association }
func (a notificationBelongsToSourceUserTx) Find() (result *models.User, err error) {
@ -751,6 +805,11 @@ func (a notificationBelongsToSourceUserTx) Count() int64 {
return a.tx.Count()
}
func (a notificationBelongsToSourceUserTx) Unscoped() *notificationBelongsToSourceUserTx {
a.tx = a.tx.Unscoped()
return &a
}
type notificationDo struct{ gen.DO }
type INotificationDo interface {
@ -808,6 +867,8 @@ type INotificationDo interface {
FirstOrCreate() (*models.Notification, error)
FindByPage(offset int, limit int) (result []*models.Notification, count int64, err error)
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
Rows() (*sql.Rows, error)
Row() *sql.Row
Scan(result interface{}) (err error)
Returning(value interface{}, columns ...string) INotificationDo
UnderlyingDB() *gorm.DB