Compare commits
No commits in common. "9496ba0cc6572f7f2d7e378164f753945138899a" and "0932f19f7152ca8087618e7db6afd9673a8f0b95" have entirely different histories.
9496ba0cc6
...
0932f19f71
37 changed files with 47 additions and 6845 deletions
|
@ -1,9 +0,0 @@
|
||||||
package auth
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/go-webauthn/webauthn/webauthn"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Authenticator struct {
|
|
||||||
webauthn *webauthn.WebAuthn
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
package auth
|
|
||||||
|
|
||||||
import "errors"
|
|
||||||
|
|
||||||
var (
|
|
||||||
// The provided authentication method is not known to the server
|
|
||||||
ErrUnknownAuthMethod = errors.New("unknown authentication method")
|
|
||||||
// The user hasn't setup the provided authentication method
|
|
||||||
ErrUnsupportedAuthMethod = errors.New("authentication method not supported for this user")
|
|
||||||
ErrInvalidCombination = errors.New("invalid account and token combination")
|
|
||||||
)
|
|
|
@ -1,67 +0,0 @@
|
||||||
package auth
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
|
|
||||||
"git.mstar.dev/mstar/goutils/sliceutils"
|
|
||||||
"github.com/go-webauthn/webauthn/webauthn"
|
|
||||||
"github.com/rs/zerolog/log"
|
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
|
||||||
)
|
|
||||||
|
|
||||||
type fakeUser struct {
|
|
||||||
actualUser *models.User
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure that fakeUser always implements webauthn.User
|
|
||||||
var _ webauthn.User = &fakeUser{}
|
|
||||||
|
|
||||||
// WebAuthnID provides the user handle of the user account. A user handle is an opaque byte sequence with a maximum
|
|
||||||
// size of 64 bytes, and is not meant to be displayed to the user.
|
|
||||||
//
|
|
||||||
// To ensure secure operation, authentication and authorization decisions MUST be made on the basis of this id
|
|
||||||
// member, not the displayName nor name members. See Section 6.1 of [RFC8266].
|
|
||||||
//
|
|
||||||
// It's recommended this value is completely random and uses the entire 64 bytes.
|
|
||||||
//
|
|
||||||
// Specification: §5.4.3. User Account Parameters for Credential Generation (https://w3c.github.io/webauthn/#dom-publickeycredentialuserentity-id)
|
|
||||||
func (fakeuser *fakeUser) WebAuthnID() []byte {
|
|
||||||
return fakeuser.actualUser.PasskeyId
|
|
||||||
}
|
|
||||||
|
|
||||||
// WebAuthnName provides the name attribute of the user account during registration and is a human-palatable name for the user
|
|
||||||
// account, intended only for display. For example, "Alex Müller" or "田中倫". The Relying Party SHOULD let the user
|
|
||||||
// choose this, and SHOULD NOT restrict the choice more than necessary.
|
|
||||||
//
|
|
||||||
// Specification: §5.4.3. User Account Parameters for Credential Generation (https://w3c.github.io/webauthn/#dictdef-publickeycredentialuserentity)
|
|
||||||
func (fakeuser *fakeUser) WebAuthnName() string {
|
|
||||||
return fakeuser.actualUser.DisplayName
|
|
||||||
}
|
|
||||||
|
|
||||||
// WebAuthnDisplayName provides the name attribute of the user account during registration and is a human-palatable
|
|
||||||
// name for the user account, intended only for display. For example, "Alex Müller" or "田中倫". The Relying Party
|
|
||||||
// SHOULD let the user choose this, and SHOULD NOT restrict the choice more than necessary.
|
|
||||||
//
|
|
||||||
// Specification: §5.4.3. User Account Parameters for Credential Generation (https://www.w3.org/TR/webauthn/#dom-publickeycredentialuserentity-displayname)
|
|
||||||
func (fakeuser *fakeUser) WebAuthnDisplayName() string {
|
|
||||||
return fakeuser.actualUser.DisplayName
|
|
||||||
}
|
|
||||||
|
|
||||||
// WebAuthnCredentials provides the list of Credential objects owned by the user.
|
|
||||||
func (fakeuser *fakeUser) WebAuthnCredentials() []webauthn.Credential {
|
|
||||||
// Basically just convert the relevant entries from the user to a credential
|
|
||||||
return sliceutils.Map(sliceutils.Filter(
|
|
||||||
fakeuser.actualUser.AuthMethods,
|
|
||||||
func(t models.UserAuthMethod) bool {
|
|
||||||
return t.AuthMethod == models.AuthMethodPasskey ||
|
|
||||||
t.AuthMethod == models.AuthMethodPasskey2fa
|
|
||||||
}), func(t models.UserAuthMethod) webauthn.Credential {
|
|
||||||
var c webauthn.Credential
|
|
||||||
if err := json.Unmarshal(t.Token, &c); err != nil {
|
|
||||||
// TODO: Is there any better way to handle the error here?
|
|
||||||
log.Error().Err(err).Msg("Failed to unmarshal webauthn credential")
|
|
||||||
}
|
|
||||||
return c
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -1,161 +0,0 @@
|
||||||
package auth
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"git.mstar.dev/mstar/goutils/other"
|
|
||||||
"git.mstar.dev/mstar/goutils/sliceutils"
|
|
||||||
"golang.org/x/crypto/bcrypt"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
"gorm.io/gorm/clause"
|
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/storage-new/dbgen"
|
|
||||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
|
||||||
)
|
|
||||||
|
|
||||||
type LoginNextState uint8
|
|
||||||
|
|
||||||
const (
|
|
||||||
LoginNextFailure LoginNextState = 0 // Login failed (default state)
|
|
||||||
LoginNextSucess LoginNextState = 1 << iota // Login suceeded
|
|
||||||
LoginUnknown // Unknown login method type, should result in failure
|
|
||||||
LoginNext2FaTotp // Login requires a totp token next as 2fa response
|
|
||||||
LoginNext2FaPasskey // Login requires a passkey token next as 2fa response
|
|
||||||
LoginNext2FaMail // Login requires an email token next as 2fa response
|
|
||||||
LoginStartPassword // Login starts with a password
|
|
||||||
LoginStartPasskey // Login starts with a passkey
|
|
||||||
)
|
|
||||||
|
|
||||||
func ConvertNewStorageAuthMethodsToLoginState(
|
|
||||||
methods []models.AuthenticationMethodType,
|
|
||||||
isStart bool,
|
|
||||||
) LoginNextState {
|
|
||||||
translatedMethods := sliceutils.Map(methods, oneStorageAuthToLoginState)
|
|
||||||
// Filter out only the valid methods for the current request
|
|
||||||
valids := sliceutils.Filter(translatedMethods, func(t LoginNextState) bool {
|
|
||||||
if isStart {
|
|
||||||
return t == LoginStartPasskey || t == LoginStartPassword
|
|
||||||
} else {
|
|
||||||
return t == LoginNext2FaTotp || t == LoginNext2FaPasskey || t == LoginNext2FaMail
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// And then compact them down into one bit flag
|
|
||||||
return sliceutils.Compact(
|
|
||||||
valids,
|
|
||||||
func(acc, next LoginNextState) LoginNextState { return acc | next },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func oneStorageAuthToLoginState(in models.AuthenticationMethodType) LoginNextState {
|
|
||||||
switch in {
|
|
||||||
case models.AuthMethodGAuth:
|
|
||||||
return LoginNext2FaTotp
|
|
||||||
case models.AuthMethodMail:
|
|
||||||
return LoginNext2FaMail
|
|
||||||
case models.AuthMethodPasskey:
|
|
||||||
return LoginStartPasskey
|
|
||||||
case models.AuthMethodPasskey2fa:
|
|
||||||
return LoginNext2FaPasskey
|
|
||||||
case models.AuthMethodPassword:
|
|
||||||
return LoginStartPassword
|
|
||||||
default:
|
|
||||||
return LoginUnknown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func hashPassword(password string) ([]byte, error) {
|
|
||||||
return bcrypt.GenerateFromPassword([]byte(password), 14)
|
|
||||||
}
|
|
||||||
|
|
||||||
func comparePassword(password string, hash []byte) bool {
|
|
||||||
return bcrypt.CompareHashAndPassword(hash, []byte(password)) == nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start a login process with a username (NOT account ID) and password
|
|
||||||
// Returns the next state, a token corresponding to that state and error
|
|
||||||
// Token will be empty on failure, error describes the reason for the
|
|
||||||
// failure
|
|
||||||
func (a *Authenticator) StartPasswordLogin(
|
|
||||||
username string,
|
|
||||||
password string,
|
|
||||||
) (nextState LoginNextState, token string, err error) {
|
|
||||||
var acc *models.User
|
|
||||||
acc, err = dbgen.User.Where(dbgen.User.Username.Eq(username)).First()
|
|
||||||
switch err {
|
|
||||||
case nil:
|
|
||||||
break
|
|
||||||
case gorm.ErrRecordNotFound:
|
|
||||||
return LoginNextFailure, "", ErrInvalidCombination
|
|
||||||
}
|
|
||||||
|
|
||||||
var method *models.UserAuthMethod
|
|
||||||
for _, authMethod := range acc.AuthMethods {
|
|
||||||
if oneStorageAuthToLoginState(authMethod.AuthMethod) == LoginStartPassword {
|
|
||||||
method = &authMethod
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if method == nil {
|
|
||||||
return LoginNextFailure, "", ErrUnsupportedAuthMethod
|
|
||||||
}
|
|
||||||
if !comparePassword(password, method.Token) {
|
|
||||||
return LoginNextFailure, "", ErrInvalidCombination
|
|
||||||
}
|
|
||||||
nextStates := ConvertNewStorageAuthMethodsToLoginState(
|
|
||||||
sliceutils.Map(
|
|
||||||
acc.AuthMethods,
|
|
||||||
func(t models.UserAuthMethod) models.AuthenticationMethodType {
|
|
||||||
return t.AuthMethod
|
|
||||||
},
|
|
||||||
),
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
// Catch unknown login methods
|
|
||||||
if nextStates&LoginUnknown == LoginUnknown {
|
|
||||||
return LoginNextFailure, "", ErrUnknownAuthMethod
|
|
||||||
}
|
|
||||||
|
|
||||||
if nextStates == LoginNextFailure {
|
|
||||||
// Login ok, no 2fa needed
|
|
||||||
// Create a new token. Don't generate the token itself, let postgres handle that
|
|
||||||
token := models.AccessToken{
|
|
||||||
User: *acc,
|
|
||||||
UserId: acc.ID,
|
|
||||||
ExpiresAt: time.Now().Add(time.Hour * 24 * 365),
|
|
||||||
}
|
|
||||||
err = dbgen.AccessToken.
|
|
||||||
// technically, the chance of a conflict is so incredibly low that it should never ever occur
|
|
||||||
// since both the username and a randomly generated uuid would need to be created the same. Twice
|
|
||||||
// But, just in case, do this
|
|
||||||
Clauses(clause.OnConflict{DoNothing: true}).
|
|
||||||
Omit(dbgen.AccessToken.Token).
|
|
||||||
Create(&token)
|
|
||||||
if err != nil {
|
|
||||||
return LoginNextFailure, "", other.Error(
|
|
||||||
"auth",
|
|
||||||
"failed to create new access token",
|
|
||||||
err,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return LoginNextSucess, token.Token, nil
|
|
||||||
}
|
|
||||||
// TODO: Generate login process token
|
|
||||||
loginToken := models.LoginProcessToken{
|
|
||||||
User: *acc,
|
|
||||||
UserId: acc.ID,
|
|
||||||
ExpiresAt: time.Now().Add(time.Minute * 5),
|
|
||||||
}
|
|
||||||
err = dbgen.LoginProcessToken.Clauses(clause.OnConflict{DoNothing: true}).
|
|
||||||
Omit(dbgen.LoginProcessToken.Token).
|
|
||||||
Create(&loginToken)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return LoginNextFailure, "", other.Error(
|
|
||||||
"auth",
|
|
||||||
"failed to create login process token",
|
|
||||||
err,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nextStates, loginToken.Token, nil
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package auth
|
|
||||||
|
|
||||||
import "git.mstar.dev/mstar/linstrom/storage-new/dbgen"
|
|
||||||
|
|
||||||
func (a *Authenticator) StartPasskeyLogin(username string) error {
|
|
||||||
acc, err := dbgen.User.Where(dbgen.User.Username.Eq(username)).First()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
_ = acc
|
|
||||||
panic("Not implemented") // TODO: Implement me
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *Authenticator) CompletePasskeyLogin(username string) error {
|
|
||||||
panic("Not implemented") // TODO: Implement me
|
|
||||||
}
|
|
|
@ -2,9 +2,8 @@ package auth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.mstar.dev/mstar/goutils/sliceutils"
|
"git.mstar.dev/mstar/goutils/sliceutils"
|
||||||
"github.com/rs/zerolog/log"
|
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/storage"
|
"git.mstar.dev/mstar/linstrom/storage"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Can actorId read the account with targetId?
|
// Can actorId read the account with targetId?
|
||||||
|
@ -34,14 +33,17 @@ func (a *Authentication) CanReadAccount(actorId *string, targetId string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
combined := storage.CollapseRolesIntoOne(roles...)
|
combined := storage.CollapseRolesIntoOne(roles...)
|
||||||
return !sliceutils.Contains(combined.BlockedUsers, *actorId)
|
if sliceutils.Contains(combined.BlockedUsers, *actorId) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can actorId edit the account with targetId?
|
// Can actorId edit the account with targetId?
|
||||||
// If actorId is nil, it is assumed to be an anonymous user trying to edit the target account
|
// If actorId is nil, it is assumed to be an anonymous user trying to edit the target account
|
||||||
// if targetId is nil, it is assumed that the actor is editing themselves
|
// if targetId is nil, it is assumed that the actor is editing themselves
|
||||||
func (a *Authentication) CanEditAccount(actorId *string, targetId *string) bool {
|
func (a *Authentication) CanEditAccount(actorId *string, targetId *string) bool {
|
||||||
// WARN: This entire function feels wrong, idk
|
// FIXME: This entire function feels wrong, idk
|
||||||
// Only the owner of an account should be able to edit said account's data
|
// Only the owner of an account should be able to edit said account's data
|
||||||
// But how do moderation actions play with this? Do they count as edit or as something separate?
|
// But how do moderation actions play with this? Do they count as edit or as something separate?
|
||||||
if actorId == nil {
|
if actorId == nil {
|
||||||
|
|
12
go.mod
12
go.mod
|
@ -1,8 +1,8 @@
|
||||||
module git.mstar.dev/mstar/linstrom
|
module git.mstar.dev/mstar/linstrom
|
||||||
|
|
||||||
go 1.23.0
|
go 1.23
|
||||||
|
|
||||||
toolchain go1.23.7
|
toolchain go1.23.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.mstar.dev/mstar/goutils v1.9.1
|
git.mstar.dev/mstar/goutils v1.9.1
|
||||||
|
@ -25,7 +25,6 @@ require (
|
||||||
github.com/testcontainers/testcontainers-go/modules/postgres v0.35.0
|
github.com/testcontainers/testcontainers-go/modules/postgres v0.35.0
|
||||||
github.com/xhit/go-simple-mail/v2 v2.16.0
|
github.com/xhit/go-simple-mail/v2 v2.16.0
|
||||||
gitlab.com/mstarongitlab/goap v1.1.0
|
gitlab.com/mstarongitlab/goap v1.1.0
|
||||||
golang.org/x/crypto v0.36.0
|
|
||||||
golang.org/x/image v0.20.0
|
golang.org/x/image v0.20.0
|
||||||
gorm.io/driver/postgres v1.5.7
|
gorm.io/driver/postgres v1.5.7
|
||||||
gorm.io/gen v0.3.26
|
gorm.io/gen v0.3.26
|
||||||
|
@ -47,7 +46,7 @@ require (
|
||||||
github.com/prometheus/common v0.37.0 // indirect
|
github.com/prometheus/common v0.37.0 // indirect
|
||||||
github.com/prometheus/procfs v0.8.0 // indirect
|
github.com/prometheus/procfs v0.8.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect
|
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect
|
||||||
golang.org/x/sync v0.12.0 // indirect
|
golang.org/x/sync v0.10.0 // indirect
|
||||||
google.golang.org/protobuf v1.33.0 // indirect
|
google.golang.org/protobuf v1.33.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -125,10 +124,11 @@ require (
|
||||||
go.opentelemetry.io/otel v1.24.0 // indirect
|
go.opentelemetry.io/otel v1.24.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v1.24.0 // indirect
|
go.opentelemetry.io/otel/metric v1.24.0 // indirect
|
||||||
go.opentelemetry.io/otel/trace v1.24.0 // indirect
|
go.opentelemetry.io/otel/trace v1.24.0 // indirect
|
||||||
|
golang.org/x/crypto v0.31.0 // indirect
|
||||||
golang.org/x/mod v0.17.0 // indirect
|
golang.org/x/mod v0.17.0 // indirect
|
||||||
golang.org/x/net v0.30.0 // indirect
|
golang.org/x/net v0.30.0 // indirect
|
||||||
golang.org/x/sys v0.31.0 // indirect
|
golang.org/x/sys v0.28.0 // indirect
|
||||||
golang.org/x/text v0.23.0 // indirect
|
golang.org/x/text v0.21.0 // indirect
|
||||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
|
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
gorm.io/datatypes v1.2.5 // indirect
|
gorm.io/datatypes v1.2.5 // indirect
|
||||||
|
|
20
go.sum
20
go.sum
|
@ -459,8 +459,8 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
|
||||||
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||||
|
@ -558,8 +558,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
|
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
|
||||||
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
@ -614,13 +614,13 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
||||||
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
|
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
|
||||||
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
|
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
|
||||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
@ -630,8 +630,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||||
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
|
2
main.go
2
main.go
|
@ -89,5 +89,7 @@ func main() {
|
||||||
server.Start(":8000")
|
server.Start(":8000")
|
||||||
// TODO: Set up media server
|
// TODO: Set up media server
|
||||||
// TODO: Set up queues
|
// TODO: Set up queues
|
||||||
|
// TODO: Set up http server
|
||||||
// TODO: Set up plugins
|
// TODO: Set up plugins
|
||||||
|
// TODO: Start everything
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,668 +0,0 @@
|
||||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
||||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
||||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package dbgen
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
"gorm.io/gorm/clause"
|
|
||||||
"gorm.io/gorm/schema"
|
|
||||||
|
|
||||||
"gorm.io/gen"
|
|
||||||
"gorm.io/gen/field"
|
|
||||||
|
|
||||||
"gorm.io/plugin/dbresolver"
|
|
||||||
)
|
|
||||||
|
|
||||||
func newAccessToken(db *gorm.DB, opts ...gen.DOOption) accessToken {
|
|
||||||
_accessToken := accessToken{}
|
|
||||||
|
|
||||||
_accessToken.accessTokenDo.UseDB(db, opts...)
|
|
||||||
_accessToken.accessTokenDo.UseModel(&models.AccessToken{})
|
|
||||||
|
|
||||||
tableName := _accessToken.accessTokenDo.TableName()
|
|
||||||
_accessToken.ALL = field.NewAsterisk(tableName)
|
|
||||||
_accessToken.UserId = field.NewString(tableName, "user_id")
|
|
||||||
_accessToken.Token = field.NewString(tableName, "token")
|
|
||||||
_accessToken.Name = field.NewString(tableName, "name")
|
|
||||||
_accessToken.ExpiresAt = field.NewTime(tableName, "expires_at")
|
|
||||||
_accessToken.User = accessTokenBelongsToUser{
|
|
||||||
db: db.Session(&gorm.Session{}),
|
|
||||||
|
|
||||||
RelationField: field.NewRelation("User", "models.User"),
|
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
_accessToken.fillFieldMap()
|
|
||||||
|
|
||||||
return _accessToken
|
|
||||||
}
|
|
||||||
|
|
||||||
type accessToken struct {
|
|
||||||
accessTokenDo
|
|
||||||
|
|
||||||
ALL field.Asterisk
|
|
||||||
UserId field.String
|
|
||||||
Token field.String
|
|
||||||
Name field.String
|
|
||||||
ExpiresAt field.Time
|
|
||||||
User accessTokenBelongsToUser
|
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessToken) Table(newTableName string) *accessToken {
|
|
||||||
a.accessTokenDo.UseTable(newTableName)
|
|
||||||
return a.updateTableName(newTableName)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessToken) As(alias string) *accessToken {
|
|
||||||
a.accessTokenDo.DO = *(a.accessTokenDo.As(alias).(*gen.DO))
|
|
||||||
return a.updateTableName(alias)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *accessToken) updateTableName(table string) *accessToken {
|
|
||||||
a.ALL = field.NewAsterisk(table)
|
|
||||||
a.UserId = field.NewString(table, "user_id")
|
|
||||||
a.Token = field.NewString(table, "token")
|
|
||||||
a.Name = field.NewString(table, "name")
|
|
||||||
a.ExpiresAt = field.NewTime(table, "expires_at")
|
|
||||||
|
|
||||||
a.fillFieldMap()
|
|
||||||
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *accessToken) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|
||||||
_f, ok := a.fieldMap[fieldName]
|
|
||||||
if !ok || _f == nil {
|
|
||||||
return nil, false
|
|
||||||
}
|
|
||||||
_oe, ok := _f.(field.OrderExpr)
|
|
||||||
return _oe, ok
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *accessToken) fillFieldMap() {
|
|
||||||
a.fieldMap = make(map[string]field.Expr, 5)
|
|
||||||
a.fieldMap["user_id"] = a.UserId
|
|
||||||
a.fieldMap["token"] = a.Token
|
|
||||||
a.fieldMap["name"] = a.Name
|
|
||||||
a.fieldMap["expires_at"] = a.ExpiresAt
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessToken) clone(db *gorm.DB) accessToken {
|
|
||||||
a.accessTokenDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessToken) replaceDB(db *gorm.DB) accessToken {
|
|
||||||
a.accessTokenDo.ReplaceDB(db)
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
|
|
||||||
type accessTokenBelongsToUser struct {
|
|
||||||
db *gorm.DB
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenBelongsToUser) Where(conds ...field.Expr) *accessTokenBelongsToUser {
|
|
||||||
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 accessTokenBelongsToUser) WithContext(ctx context.Context) *accessTokenBelongsToUser {
|
|
||||||
a.db = a.db.WithContext(ctx)
|
|
||||||
return &a
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenBelongsToUser) Session(session *gorm.Session) *accessTokenBelongsToUser {
|
|
||||||
a.db = a.db.Session(session)
|
|
||||||
return &a
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenBelongsToUser) Model(m *models.AccessToken) *accessTokenBelongsToUserTx {
|
|
||||||
return &accessTokenBelongsToUserTx{a.db.Model(m).Association(a.Name())}
|
|
||||||
}
|
|
||||||
|
|
||||||
type accessTokenBelongsToUserTx struct{ tx *gorm.Association }
|
|
||||||
|
|
||||||
func (a accessTokenBelongsToUserTx) Find() (result *models.User, err error) {
|
|
||||||
return result, a.tx.Find(&result)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenBelongsToUserTx) 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 accessTokenBelongsToUserTx) 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 accessTokenBelongsToUserTx) 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 accessTokenBelongsToUserTx) Clear() error {
|
|
||||||
return a.tx.Clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenBelongsToUserTx) Count() int64 {
|
|
||||||
return a.tx.Count()
|
|
||||||
}
|
|
||||||
|
|
||||||
type accessTokenDo struct{ gen.DO }
|
|
||||||
|
|
||||||
type IAccessTokenDo interface {
|
|
||||||
gen.SubQuery
|
|
||||||
Debug() IAccessTokenDo
|
|
||||||
WithContext(ctx context.Context) IAccessTokenDo
|
|
||||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
|
||||||
ReplaceDB(db *gorm.DB)
|
|
||||||
ReadDB() IAccessTokenDo
|
|
||||||
WriteDB() IAccessTokenDo
|
|
||||||
As(alias string) gen.Dao
|
|
||||||
Session(config *gorm.Session) IAccessTokenDo
|
|
||||||
Columns(cols ...field.Expr) gen.Columns
|
|
||||||
Clauses(conds ...clause.Expression) IAccessTokenDo
|
|
||||||
Not(conds ...gen.Condition) IAccessTokenDo
|
|
||||||
Or(conds ...gen.Condition) IAccessTokenDo
|
|
||||||
Select(conds ...field.Expr) IAccessTokenDo
|
|
||||||
Where(conds ...gen.Condition) IAccessTokenDo
|
|
||||||
Order(conds ...field.Expr) IAccessTokenDo
|
|
||||||
Distinct(cols ...field.Expr) IAccessTokenDo
|
|
||||||
Omit(cols ...field.Expr) IAccessTokenDo
|
|
||||||
Join(table schema.Tabler, on ...field.Expr) IAccessTokenDo
|
|
||||||
LeftJoin(table schema.Tabler, on ...field.Expr) IAccessTokenDo
|
|
||||||
RightJoin(table schema.Tabler, on ...field.Expr) IAccessTokenDo
|
|
||||||
Group(cols ...field.Expr) IAccessTokenDo
|
|
||||||
Having(conds ...gen.Condition) IAccessTokenDo
|
|
||||||
Limit(limit int) IAccessTokenDo
|
|
||||||
Offset(offset int) IAccessTokenDo
|
|
||||||
Count() (count int64, err error)
|
|
||||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IAccessTokenDo
|
|
||||||
Unscoped() IAccessTokenDo
|
|
||||||
Create(values ...*models.AccessToken) error
|
|
||||||
CreateInBatches(values []*models.AccessToken, batchSize int) error
|
|
||||||
Save(values ...*models.AccessToken) error
|
|
||||||
First() (*models.AccessToken, error)
|
|
||||||
Take() (*models.AccessToken, error)
|
|
||||||
Last() (*models.AccessToken, error)
|
|
||||||
Find() ([]*models.AccessToken, error)
|
|
||||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.AccessToken, err error)
|
|
||||||
FindInBatches(result *[]*models.AccessToken, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
|
||||||
Pluck(column field.Expr, dest interface{}) error
|
|
||||||
Delete(...*models.AccessToken) (info gen.ResultInfo, err error)
|
|
||||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
|
||||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
|
||||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
|
||||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
|
||||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
|
||||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
|
||||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
|
||||||
Attrs(attrs ...field.AssignExpr) IAccessTokenDo
|
|
||||||
Assign(attrs ...field.AssignExpr) IAccessTokenDo
|
|
||||||
Joins(fields ...field.RelationField) IAccessTokenDo
|
|
||||||
Preload(fields ...field.RelationField) IAccessTokenDo
|
|
||||||
FirstOrInit() (*models.AccessToken, error)
|
|
||||||
FirstOrCreate() (*models.AccessToken, error)
|
|
||||||
FindByPage(offset int, limit int) (result []*models.AccessToken, count int64, err error)
|
|
||||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
|
||||||
Scan(result interface{}) (err error)
|
|
||||||
Returning(value interface{}, columns ...string) IAccessTokenDo
|
|
||||||
UnderlyingDB() *gorm.DB
|
|
||||||
schema.Tabler
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Debug() IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Debug())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) WithContext(ctx context.Context) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.WithContext(ctx))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) ReadDB() IAccessTokenDo {
|
|
||||||
return a.Clauses(dbresolver.Read)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) WriteDB() IAccessTokenDo {
|
|
||||||
return a.Clauses(dbresolver.Write)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Session(config *gorm.Session) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Session(config))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Clauses(conds ...clause.Expression) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Clauses(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Returning(value interface{}, columns ...string) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Returning(value, columns...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Not(conds ...gen.Condition) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Not(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Or(conds ...gen.Condition) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Or(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Select(conds ...field.Expr) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Select(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Where(conds ...gen.Condition) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Where(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Order(conds ...field.Expr) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Order(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Distinct(cols ...field.Expr) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Distinct(cols...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Omit(cols ...field.Expr) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Omit(cols...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Join(table schema.Tabler, on ...field.Expr) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Join(table, on...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) LeftJoin(table schema.Tabler, on ...field.Expr) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.LeftJoin(table, on...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) RightJoin(table schema.Tabler, on ...field.Expr) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.RightJoin(table, on...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Group(cols ...field.Expr) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Group(cols...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Having(conds ...gen.Condition) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Having(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Limit(limit int) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Limit(limit))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Offset(offset int) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Offset(offset))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Scopes(funcs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Unscoped() IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Unscoped())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Create(values ...*models.AccessToken) error {
|
|
||||||
if len(values) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return a.DO.Create(values)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) CreateInBatches(values []*models.AccessToken, batchSize int) error {
|
|
||||||
return a.DO.CreateInBatches(values, batchSize)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save : !!! underlying implementation is different with GORM
|
|
||||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
|
||||||
func (a accessTokenDo) Save(values ...*models.AccessToken) error {
|
|
||||||
if len(values) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return a.DO.Save(values)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) First() (*models.AccessToken, error) {
|
|
||||||
if result, err := a.DO.First(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.AccessToken), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Take() (*models.AccessToken, error) {
|
|
||||||
if result, err := a.DO.Take(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.AccessToken), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Last() (*models.AccessToken, error) {
|
|
||||||
if result, err := a.DO.Last(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.AccessToken), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Find() ([]*models.AccessToken, error) {
|
|
||||||
result, err := a.DO.Find()
|
|
||||||
return result.([]*models.AccessToken), err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.AccessToken, err error) {
|
|
||||||
buf := make([]*models.AccessToken, 0, batchSize)
|
|
||||||
err = a.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
|
||||||
defer func() { results = append(results, buf...) }()
|
|
||||||
return fc(tx, batch)
|
|
||||||
})
|
|
||||||
return results, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) FindInBatches(result *[]*models.AccessToken, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
||||||
return a.DO.FindInBatches(result, batchSize, fc)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Attrs(attrs ...field.AssignExpr) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Attrs(attrs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Assign(attrs ...field.AssignExpr) IAccessTokenDo {
|
|
||||||
return a.withDO(a.DO.Assign(attrs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Joins(fields ...field.RelationField) IAccessTokenDo {
|
|
||||||
for _, _f := range fields {
|
|
||||||
a = *a.withDO(a.DO.Joins(_f))
|
|
||||||
}
|
|
||||||
return &a
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Preload(fields ...field.RelationField) IAccessTokenDo {
|
|
||||||
for _, _f := range fields {
|
|
||||||
a = *a.withDO(a.DO.Preload(_f))
|
|
||||||
}
|
|
||||||
return &a
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) FirstOrInit() (*models.AccessToken, error) {
|
|
||||||
if result, err := a.DO.FirstOrInit(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.AccessToken), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) FirstOrCreate() (*models.AccessToken, error) {
|
|
||||||
if result, err := a.DO.FirstOrCreate(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.AccessToken), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) FindByPage(offset int, limit int) (result []*models.AccessToken, count int64, err error) {
|
|
||||||
result, err = a.Offset(offset).Limit(limit).Find()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
|
||||||
count = int64(size + offset)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
count, err = a.Offset(-1).Limit(-1).Count()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
|
||||||
count, err = a.Count()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
err = a.Offset(offset).Limit(limit).Scan(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Scan(result interface{}) (err error) {
|
|
||||||
return a.DO.Scan(result)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a accessTokenDo) Delete(models ...*models.AccessToken) (result gen.ResultInfo, err error) {
|
|
||||||
return a.DO.Delete(models)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *accessTokenDo) withDO(do gen.Dao) *accessTokenDo {
|
|
||||||
a.DO = *do.(*gen.DO)
|
|
||||||
return a
|
|
||||||
}
|
|
|
@ -43,11 +43,6 @@ func newEmote(db *gorm.DB, opts ...gen.DOOption) emote {
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
RelationField: field.NewRelation("Server", "models.RemoteServer"),
|
RelationField: field.NewRelation("Server", "models.RemoteServer"),
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Server.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_emote.fillFieldMap()
|
_emote.fillFieldMap()
|
||||||
|
@ -204,10 +199,6 @@ type emoteBelongsToServer struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
|
||||||
field.RelationField
|
field.RelationField
|
||||||
|
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a emoteBelongsToServer) Where(conds ...field.Expr) *emoteBelongsToServer {
|
func (a emoteBelongsToServer) Where(conds ...field.Expr) *emoteBelongsToServer {
|
||||||
|
|
|
@ -17,9 +17,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Q = new(Query)
|
Q = new(Query)
|
||||||
AccessToken *accessToken
|
|
||||||
Emote *emote
|
Emote *emote
|
||||||
LoginProcessToken *loginProcessToken
|
|
||||||
MediaMetadata *mediaMetadata
|
MediaMetadata *mediaMetadata
|
||||||
Note *note
|
Note *note
|
||||||
NoteTag *noteTag
|
NoteTag *noteTag
|
||||||
|
@ -34,7 +32,6 @@ var (
|
||||||
UserInfoField *userInfoField
|
UserInfoField *userInfoField
|
||||||
UserRemoteLinks *userRemoteLinks
|
UserRemoteLinks *userRemoteLinks
|
||||||
UserToBeing *userToBeing
|
UserToBeing *userToBeing
|
||||||
UserToPronoun *userToPronoun
|
|
||||||
UserToRole *userToRole
|
UserToRole *userToRole
|
||||||
UserToTag *userToTag
|
UserToTag *userToTag
|
||||||
UserToUserRelation *userToUserRelation
|
UserToUserRelation *userToUserRelation
|
||||||
|
@ -42,9 +39,7 @@ var (
|
||||||
|
|
||||||
func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
||||||
*Q = *Use(db, opts...)
|
*Q = *Use(db, opts...)
|
||||||
AccessToken = &Q.AccessToken
|
|
||||||
Emote = &Q.Emote
|
Emote = &Q.Emote
|
||||||
LoginProcessToken = &Q.LoginProcessToken
|
|
||||||
MediaMetadata = &Q.MediaMetadata
|
MediaMetadata = &Q.MediaMetadata
|
||||||
Note = &Q.Note
|
Note = &Q.Note
|
||||||
NoteTag = &Q.NoteTag
|
NoteTag = &Q.NoteTag
|
||||||
|
@ -59,7 +54,6 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
||||||
UserInfoField = &Q.UserInfoField
|
UserInfoField = &Q.UserInfoField
|
||||||
UserRemoteLinks = &Q.UserRemoteLinks
|
UserRemoteLinks = &Q.UserRemoteLinks
|
||||||
UserToBeing = &Q.UserToBeing
|
UserToBeing = &Q.UserToBeing
|
||||||
UserToPronoun = &Q.UserToPronoun
|
|
||||||
UserToRole = &Q.UserToRole
|
UserToRole = &Q.UserToRole
|
||||||
UserToTag = &Q.UserToTag
|
UserToTag = &Q.UserToTag
|
||||||
UserToUserRelation = &Q.UserToUserRelation
|
UserToUserRelation = &Q.UserToUserRelation
|
||||||
|
@ -68,9 +62,7 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
||||||
func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||||
return &Query{
|
return &Query{
|
||||||
db: db,
|
db: db,
|
||||||
AccessToken: newAccessToken(db, opts...),
|
|
||||||
Emote: newEmote(db, opts...),
|
Emote: newEmote(db, opts...),
|
||||||
LoginProcessToken: newLoginProcessToken(db, opts...),
|
|
||||||
MediaMetadata: newMediaMetadata(db, opts...),
|
MediaMetadata: newMediaMetadata(db, opts...),
|
||||||
Note: newNote(db, opts...),
|
Note: newNote(db, opts...),
|
||||||
NoteTag: newNoteTag(db, opts...),
|
NoteTag: newNoteTag(db, opts...),
|
||||||
|
@ -85,7 +77,6 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||||
UserInfoField: newUserInfoField(db, opts...),
|
UserInfoField: newUserInfoField(db, opts...),
|
||||||
UserRemoteLinks: newUserRemoteLinks(db, opts...),
|
UserRemoteLinks: newUserRemoteLinks(db, opts...),
|
||||||
UserToBeing: newUserToBeing(db, opts...),
|
UserToBeing: newUserToBeing(db, opts...),
|
||||||
UserToPronoun: newUserToPronoun(db, opts...),
|
|
||||||
UserToRole: newUserToRole(db, opts...),
|
UserToRole: newUserToRole(db, opts...),
|
||||||
UserToTag: newUserToTag(db, opts...),
|
UserToTag: newUserToTag(db, opts...),
|
||||||
UserToUserRelation: newUserToUserRelation(db, opts...),
|
UserToUserRelation: newUserToUserRelation(db, opts...),
|
||||||
|
@ -95,9 +86,7 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||||
type Query struct {
|
type Query struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
|
||||||
AccessToken accessToken
|
|
||||||
Emote emote
|
Emote emote
|
||||||
LoginProcessToken loginProcessToken
|
|
||||||
MediaMetadata mediaMetadata
|
MediaMetadata mediaMetadata
|
||||||
Note note
|
Note note
|
||||||
NoteTag noteTag
|
NoteTag noteTag
|
||||||
|
@ -112,7 +101,6 @@ type Query struct {
|
||||||
UserInfoField userInfoField
|
UserInfoField userInfoField
|
||||||
UserRemoteLinks userRemoteLinks
|
UserRemoteLinks userRemoteLinks
|
||||||
UserToBeing userToBeing
|
UserToBeing userToBeing
|
||||||
UserToPronoun userToPronoun
|
|
||||||
UserToRole userToRole
|
UserToRole userToRole
|
||||||
UserToTag userToTag
|
UserToTag userToTag
|
||||||
UserToUserRelation userToUserRelation
|
UserToUserRelation userToUserRelation
|
||||||
|
@ -123,9 +111,7 @@ func (q *Query) Available() bool { return q.db != nil }
|
||||||
func (q *Query) clone(db *gorm.DB) *Query {
|
func (q *Query) clone(db *gorm.DB) *Query {
|
||||||
return &Query{
|
return &Query{
|
||||||
db: db,
|
db: db,
|
||||||
AccessToken: q.AccessToken.clone(db),
|
|
||||||
Emote: q.Emote.clone(db),
|
Emote: q.Emote.clone(db),
|
||||||
LoginProcessToken: q.LoginProcessToken.clone(db),
|
|
||||||
MediaMetadata: q.MediaMetadata.clone(db),
|
MediaMetadata: q.MediaMetadata.clone(db),
|
||||||
Note: q.Note.clone(db),
|
Note: q.Note.clone(db),
|
||||||
NoteTag: q.NoteTag.clone(db),
|
NoteTag: q.NoteTag.clone(db),
|
||||||
|
@ -140,7 +126,6 @@ func (q *Query) clone(db *gorm.DB) *Query {
|
||||||
UserInfoField: q.UserInfoField.clone(db),
|
UserInfoField: q.UserInfoField.clone(db),
|
||||||
UserRemoteLinks: q.UserRemoteLinks.clone(db),
|
UserRemoteLinks: q.UserRemoteLinks.clone(db),
|
||||||
UserToBeing: q.UserToBeing.clone(db),
|
UserToBeing: q.UserToBeing.clone(db),
|
||||||
UserToPronoun: q.UserToPronoun.clone(db),
|
|
||||||
UserToRole: q.UserToRole.clone(db),
|
UserToRole: q.UserToRole.clone(db),
|
||||||
UserToTag: q.UserToTag.clone(db),
|
UserToTag: q.UserToTag.clone(db),
|
||||||
UserToUserRelation: q.UserToUserRelation.clone(db),
|
UserToUserRelation: q.UserToUserRelation.clone(db),
|
||||||
|
@ -158,9 +143,7 @@ func (q *Query) WriteDB() *Query {
|
||||||
func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||||
return &Query{
|
return &Query{
|
||||||
db: db,
|
db: db,
|
||||||
AccessToken: q.AccessToken.replaceDB(db),
|
|
||||||
Emote: q.Emote.replaceDB(db),
|
Emote: q.Emote.replaceDB(db),
|
||||||
LoginProcessToken: q.LoginProcessToken.replaceDB(db),
|
|
||||||
MediaMetadata: q.MediaMetadata.replaceDB(db),
|
MediaMetadata: q.MediaMetadata.replaceDB(db),
|
||||||
Note: q.Note.replaceDB(db),
|
Note: q.Note.replaceDB(db),
|
||||||
NoteTag: q.NoteTag.replaceDB(db),
|
NoteTag: q.NoteTag.replaceDB(db),
|
||||||
|
@ -175,7 +158,6 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||||
UserInfoField: q.UserInfoField.replaceDB(db),
|
UserInfoField: q.UserInfoField.replaceDB(db),
|
||||||
UserRemoteLinks: q.UserRemoteLinks.replaceDB(db),
|
UserRemoteLinks: q.UserRemoteLinks.replaceDB(db),
|
||||||
UserToBeing: q.UserToBeing.replaceDB(db),
|
UserToBeing: q.UserToBeing.replaceDB(db),
|
||||||
UserToPronoun: q.UserToPronoun.replaceDB(db),
|
|
||||||
UserToRole: q.UserToRole.replaceDB(db),
|
UserToRole: q.UserToRole.replaceDB(db),
|
||||||
UserToTag: q.UserToTag.replaceDB(db),
|
UserToTag: q.UserToTag.replaceDB(db),
|
||||||
UserToUserRelation: q.UserToUserRelation.replaceDB(db),
|
UserToUserRelation: q.UserToUserRelation.replaceDB(db),
|
||||||
|
@ -183,9 +165,7 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||||
}
|
}
|
||||||
|
|
||||||
type queryCtx struct {
|
type queryCtx struct {
|
||||||
AccessToken IAccessTokenDo
|
|
||||||
Emote IEmoteDo
|
Emote IEmoteDo
|
||||||
LoginProcessToken ILoginProcessTokenDo
|
|
||||||
MediaMetadata IMediaMetadataDo
|
MediaMetadata IMediaMetadataDo
|
||||||
Note INoteDo
|
Note INoteDo
|
||||||
NoteTag INoteTagDo
|
NoteTag INoteTagDo
|
||||||
|
@ -200,7 +180,6 @@ type queryCtx struct {
|
||||||
UserInfoField IUserInfoFieldDo
|
UserInfoField IUserInfoFieldDo
|
||||||
UserRemoteLinks IUserRemoteLinksDo
|
UserRemoteLinks IUserRemoteLinksDo
|
||||||
UserToBeing IUserToBeingDo
|
UserToBeing IUserToBeingDo
|
||||||
UserToPronoun IUserToPronounDo
|
|
||||||
UserToRole IUserToRoleDo
|
UserToRole IUserToRoleDo
|
||||||
UserToTag IUserToTagDo
|
UserToTag IUserToTagDo
|
||||||
UserToUserRelation IUserToUserRelationDo
|
UserToUserRelation IUserToUserRelationDo
|
||||||
|
@ -208,9 +187,7 @@ type queryCtx struct {
|
||||||
|
|
||||||
func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||||
return &queryCtx{
|
return &queryCtx{
|
||||||
AccessToken: q.AccessToken.WithContext(ctx),
|
|
||||||
Emote: q.Emote.WithContext(ctx),
|
Emote: q.Emote.WithContext(ctx),
|
||||||
LoginProcessToken: q.LoginProcessToken.WithContext(ctx),
|
|
||||||
MediaMetadata: q.MediaMetadata.WithContext(ctx),
|
MediaMetadata: q.MediaMetadata.WithContext(ctx),
|
||||||
Note: q.Note.WithContext(ctx),
|
Note: q.Note.WithContext(ctx),
|
||||||
NoteTag: q.NoteTag.WithContext(ctx),
|
NoteTag: q.NoteTag.WithContext(ctx),
|
||||||
|
@ -225,7 +202,6 @@ func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||||
UserInfoField: q.UserInfoField.WithContext(ctx),
|
UserInfoField: q.UserInfoField.WithContext(ctx),
|
||||||
UserRemoteLinks: q.UserRemoteLinks.WithContext(ctx),
|
UserRemoteLinks: q.UserRemoteLinks.WithContext(ctx),
|
||||||
UserToBeing: q.UserToBeing.WithContext(ctx),
|
UserToBeing: q.UserToBeing.WithContext(ctx),
|
||||||
UserToPronoun: q.UserToPronoun.WithContext(ctx),
|
|
||||||
UserToRole: q.UserToRole.WithContext(ctx),
|
UserToRole: q.UserToRole.WithContext(ctx),
|
||||||
UserToTag: q.UserToTag.WithContext(ctx),
|
UserToTag: q.UserToTag.WithContext(ctx),
|
||||||
UserToUserRelation: q.UserToUserRelation.WithContext(ctx),
|
UserToUserRelation: q.UserToUserRelation.WithContext(ctx),
|
||||||
|
|
|
@ -1,660 +0,0 @@
|
||||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
||||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
||||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package dbgen
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
"gorm.io/gorm/clause"
|
|
||||||
"gorm.io/gorm/schema"
|
|
||||||
|
|
||||||
"gorm.io/gen"
|
|
||||||
"gorm.io/gen/field"
|
|
||||||
|
|
||||||
"gorm.io/plugin/dbresolver"
|
|
||||||
)
|
|
||||||
|
|
||||||
func newLoginProcessToken(db *gorm.DB, opts ...gen.DOOption) loginProcessToken {
|
|
||||||
_loginProcessToken := loginProcessToken{}
|
|
||||||
|
|
||||||
_loginProcessToken.loginProcessTokenDo.UseDB(db, opts...)
|
|
||||||
_loginProcessToken.loginProcessTokenDo.UseModel(&models.LoginProcessToken{})
|
|
||||||
|
|
||||||
tableName := _loginProcessToken.loginProcessTokenDo.TableName()
|
|
||||||
_loginProcessToken.ALL = field.NewAsterisk(tableName)
|
|
||||||
_loginProcessToken.UserId = field.NewString(tableName, "user_id")
|
|
||||||
_loginProcessToken.Token = field.NewString(tableName, "token")
|
|
||||||
_loginProcessToken.User = loginProcessTokenBelongsToUser{
|
|
||||||
db: db.Session(&gorm.Session{}),
|
|
||||||
|
|
||||||
RelationField: field.NewRelation("User", "models.User"),
|
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
_loginProcessToken.fillFieldMap()
|
|
||||||
|
|
||||||
return _loginProcessToken
|
|
||||||
}
|
|
||||||
|
|
||||||
type loginProcessToken struct {
|
|
||||||
loginProcessTokenDo
|
|
||||||
|
|
||||||
ALL field.Asterisk
|
|
||||||
UserId field.String
|
|
||||||
Token field.String
|
|
||||||
User loginProcessTokenBelongsToUser
|
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessToken) Table(newTableName string) *loginProcessToken {
|
|
||||||
l.loginProcessTokenDo.UseTable(newTableName)
|
|
||||||
return l.updateTableName(newTableName)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessToken) As(alias string) *loginProcessToken {
|
|
||||||
l.loginProcessTokenDo.DO = *(l.loginProcessTokenDo.As(alias).(*gen.DO))
|
|
||||||
return l.updateTableName(alias)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *loginProcessToken) updateTableName(table string) *loginProcessToken {
|
|
||||||
l.ALL = field.NewAsterisk(table)
|
|
||||||
l.UserId = field.NewString(table, "user_id")
|
|
||||||
l.Token = field.NewString(table, "token")
|
|
||||||
|
|
||||||
l.fillFieldMap()
|
|
||||||
|
|
||||||
return l
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *loginProcessToken) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|
||||||
_f, ok := l.fieldMap[fieldName]
|
|
||||||
if !ok || _f == nil {
|
|
||||||
return nil, false
|
|
||||||
}
|
|
||||||
_oe, ok := _f.(field.OrderExpr)
|
|
||||||
return _oe, ok
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *loginProcessToken) fillFieldMap() {
|
|
||||||
l.fieldMap = make(map[string]field.Expr, 3)
|
|
||||||
l.fieldMap["user_id"] = l.UserId
|
|
||||||
l.fieldMap["token"] = l.Token
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessToken) clone(db *gorm.DB) loginProcessToken {
|
|
||||||
l.loginProcessTokenDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
||||||
return l
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessToken) replaceDB(db *gorm.DB) loginProcessToken {
|
|
||||||
l.loginProcessTokenDo.ReplaceDB(db)
|
|
||||||
return l
|
|
||||||
}
|
|
||||||
|
|
||||||
type loginProcessTokenBelongsToUser struct {
|
|
||||||
db *gorm.DB
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a loginProcessTokenBelongsToUser) Where(conds ...field.Expr) *loginProcessTokenBelongsToUser {
|
|
||||||
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 loginProcessTokenBelongsToUser) WithContext(ctx context.Context) *loginProcessTokenBelongsToUser {
|
|
||||||
a.db = a.db.WithContext(ctx)
|
|
||||||
return &a
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a loginProcessTokenBelongsToUser) Session(session *gorm.Session) *loginProcessTokenBelongsToUser {
|
|
||||||
a.db = a.db.Session(session)
|
|
||||||
return &a
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a loginProcessTokenBelongsToUser) Model(m *models.LoginProcessToken) *loginProcessTokenBelongsToUserTx {
|
|
||||||
return &loginProcessTokenBelongsToUserTx{a.db.Model(m).Association(a.Name())}
|
|
||||||
}
|
|
||||||
|
|
||||||
type loginProcessTokenBelongsToUserTx struct{ tx *gorm.Association }
|
|
||||||
|
|
||||||
func (a loginProcessTokenBelongsToUserTx) Find() (result *models.User, err error) {
|
|
||||||
return result, a.tx.Find(&result)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a loginProcessTokenBelongsToUserTx) 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 loginProcessTokenBelongsToUserTx) 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 loginProcessTokenBelongsToUserTx) 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 loginProcessTokenBelongsToUserTx) Clear() error {
|
|
||||||
return a.tx.Clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a loginProcessTokenBelongsToUserTx) Count() int64 {
|
|
||||||
return a.tx.Count()
|
|
||||||
}
|
|
||||||
|
|
||||||
type loginProcessTokenDo struct{ gen.DO }
|
|
||||||
|
|
||||||
type ILoginProcessTokenDo interface {
|
|
||||||
gen.SubQuery
|
|
||||||
Debug() ILoginProcessTokenDo
|
|
||||||
WithContext(ctx context.Context) ILoginProcessTokenDo
|
|
||||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
|
||||||
ReplaceDB(db *gorm.DB)
|
|
||||||
ReadDB() ILoginProcessTokenDo
|
|
||||||
WriteDB() ILoginProcessTokenDo
|
|
||||||
As(alias string) gen.Dao
|
|
||||||
Session(config *gorm.Session) ILoginProcessTokenDo
|
|
||||||
Columns(cols ...field.Expr) gen.Columns
|
|
||||||
Clauses(conds ...clause.Expression) ILoginProcessTokenDo
|
|
||||||
Not(conds ...gen.Condition) ILoginProcessTokenDo
|
|
||||||
Or(conds ...gen.Condition) ILoginProcessTokenDo
|
|
||||||
Select(conds ...field.Expr) ILoginProcessTokenDo
|
|
||||||
Where(conds ...gen.Condition) ILoginProcessTokenDo
|
|
||||||
Order(conds ...field.Expr) ILoginProcessTokenDo
|
|
||||||
Distinct(cols ...field.Expr) ILoginProcessTokenDo
|
|
||||||
Omit(cols ...field.Expr) ILoginProcessTokenDo
|
|
||||||
Join(table schema.Tabler, on ...field.Expr) ILoginProcessTokenDo
|
|
||||||
LeftJoin(table schema.Tabler, on ...field.Expr) ILoginProcessTokenDo
|
|
||||||
RightJoin(table schema.Tabler, on ...field.Expr) ILoginProcessTokenDo
|
|
||||||
Group(cols ...field.Expr) ILoginProcessTokenDo
|
|
||||||
Having(conds ...gen.Condition) ILoginProcessTokenDo
|
|
||||||
Limit(limit int) ILoginProcessTokenDo
|
|
||||||
Offset(offset int) ILoginProcessTokenDo
|
|
||||||
Count() (count int64, err error)
|
|
||||||
Scopes(funcs ...func(gen.Dao) gen.Dao) ILoginProcessTokenDo
|
|
||||||
Unscoped() ILoginProcessTokenDo
|
|
||||||
Create(values ...*models.LoginProcessToken) error
|
|
||||||
CreateInBatches(values []*models.LoginProcessToken, batchSize int) error
|
|
||||||
Save(values ...*models.LoginProcessToken) error
|
|
||||||
First() (*models.LoginProcessToken, error)
|
|
||||||
Take() (*models.LoginProcessToken, error)
|
|
||||||
Last() (*models.LoginProcessToken, error)
|
|
||||||
Find() ([]*models.LoginProcessToken, error)
|
|
||||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.LoginProcessToken, err error)
|
|
||||||
FindInBatches(result *[]*models.LoginProcessToken, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
|
||||||
Pluck(column field.Expr, dest interface{}) error
|
|
||||||
Delete(...*models.LoginProcessToken) (info gen.ResultInfo, err error)
|
|
||||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
|
||||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
|
||||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
|
||||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
|
||||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
|
||||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
|
||||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
|
||||||
Attrs(attrs ...field.AssignExpr) ILoginProcessTokenDo
|
|
||||||
Assign(attrs ...field.AssignExpr) ILoginProcessTokenDo
|
|
||||||
Joins(fields ...field.RelationField) ILoginProcessTokenDo
|
|
||||||
Preload(fields ...field.RelationField) ILoginProcessTokenDo
|
|
||||||
FirstOrInit() (*models.LoginProcessToken, error)
|
|
||||||
FirstOrCreate() (*models.LoginProcessToken, error)
|
|
||||||
FindByPage(offset int, limit int) (result []*models.LoginProcessToken, count int64, err error)
|
|
||||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
|
||||||
Scan(result interface{}) (err error)
|
|
||||||
Returning(value interface{}, columns ...string) ILoginProcessTokenDo
|
|
||||||
UnderlyingDB() *gorm.DB
|
|
||||||
schema.Tabler
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Debug() ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Debug())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) WithContext(ctx context.Context) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.WithContext(ctx))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) ReadDB() ILoginProcessTokenDo {
|
|
||||||
return l.Clauses(dbresolver.Read)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) WriteDB() ILoginProcessTokenDo {
|
|
||||||
return l.Clauses(dbresolver.Write)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Session(config *gorm.Session) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Session(config))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Clauses(conds ...clause.Expression) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Clauses(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Returning(value interface{}, columns ...string) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Returning(value, columns...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Not(conds ...gen.Condition) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Not(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Or(conds ...gen.Condition) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Or(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Select(conds ...field.Expr) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Select(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Where(conds ...gen.Condition) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Where(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Order(conds ...field.Expr) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Order(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Distinct(cols ...field.Expr) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Distinct(cols...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Omit(cols ...field.Expr) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Omit(cols...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Join(table schema.Tabler, on ...field.Expr) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Join(table, on...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) LeftJoin(table schema.Tabler, on ...field.Expr) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.LeftJoin(table, on...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) RightJoin(table schema.Tabler, on ...field.Expr) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.RightJoin(table, on...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Group(cols ...field.Expr) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Group(cols...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Having(conds ...gen.Condition) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Having(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Limit(limit int) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Limit(limit))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Offset(offset int) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Offset(offset))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Scopes(funcs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Unscoped() ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Unscoped())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Create(values ...*models.LoginProcessToken) error {
|
|
||||||
if len(values) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return l.DO.Create(values)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) CreateInBatches(values []*models.LoginProcessToken, batchSize int) error {
|
|
||||||
return l.DO.CreateInBatches(values, batchSize)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save : !!! underlying implementation is different with GORM
|
|
||||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
|
||||||
func (l loginProcessTokenDo) Save(values ...*models.LoginProcessToken) error {
|
|
||||||
if len(values) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return l.DO.Save(values)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) First() (*models.LoginProcessToken, error) {
|
|
||||||
if result, err := l.DO.First(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.LoginProcessToken), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Take() (*models.LoginProcessToken, error) {
|
|
||||||
if result, err := l.DO.Take(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.LoginProcessToken), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Last() (*models.LoginProcessToken, error) {
|
|
||||||
if result, err := l.DO.Last(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.LoginProcessToken), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Find() ([]*models.LoginProcessToken, error) {
|
|
||||||
result, err := l.DO.Find()
|
|
||||||
return result.([]*models.LoginProcessToken), err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.LoginProcessToken, err error) {
|
|
||||||
buf := make([]*models.LoginProcessToken, 0, batchSize)
|
|
||||||
err = l.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
|
||||||
defer func() { results = append(results, buf...) }()
|
|
||||||
return fc(tx, batch)
|
|
||||||
})
|
|
||||||
return results, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) FindInBatches(result *[]*models.LoginProcessToken, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
||||||
return l.DO.FindInBatches(result, batchSize, fc)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Attrs(attrs ...field.AssignExpr) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Attrs(attrs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Assign(attrs ...field.AssignExpr) ILoginProcessTokenDo {
|
|
||||||
return l.withDO(l.DO.Assign(attrs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Joins(fields ...field.RelationField) ILoginProcessTokenDo {
|
|
||||||
for _, _f := range fields {
|
|
||||||
l = *l.withDO(l.DO.Joins(_f))
|
|
||||||
}
|
|
||||||
return &l
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Preload(fields ...field.RelationField) ILoginProcessTokenDo {
|
|
||||||
for _, _f := range fields {
|
|
||||||
l = *l.withDO(l.DO.Preload(_f))
|
|
||||||
}
|
|
||||||
return &l
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) FirstOrInit() (*models.LoginProcessToken, error) {
|
|
||||||
if result, err := l.DO.FirstOrInit(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.LoginProcessToken), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) FirstOrCreate() (*models.LoginProcessToken, error) {
|
|
||||||
if result, err := l.DO.FirstOrCreate(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.LoginProcessToken), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) FindByPage(offset int, limit int) (result []*models.LoginProcessToken, count int64, err error) {
|
|
||||||
result, err = l.Offset(offset).Limit(limit).Find()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
|
||||||
count = int64(size + offset)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
count, err = l.Offset(-1).Limit(-1).Count()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
|
||||||
count, err = l.Count()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
err = l.Offset(offset).Limit(limit).Scan(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Scan(result interface{}) (err error) {
|
|
||||||
return l.DO.Scan(result)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l loginProcessTokenDo) Delete(models ...*models.LoginProcessToken) (result gen.ResultInfo, err error) {
|
|
||||||
return l.DO.Delete(models)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *loginProcessTokenDo) withDO(do gen.Dao) *loginProcessTokenDo {
|
|
||||||
l.DO = *do.(*gen.DO)
|
|
||||||
return l
|
|
||||||
}
|
|
|
@ -32,209 +32,6 @@ func newNoteTag(db *gorm.DB, opts ...gen.DOOption) noteTag {
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
RelationField: field.NewRelation("Note", "models.Note"),
|
RelationField: field.NewRelation("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("Note.Creator", "models.User"),
|
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AttachmentRelations: struct {
|
AttachmentRelations: struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Note struct {
|
Note struct {
|
||||||
|
@ -268,9 +65,6 @@ func newNoteTag(db *gorm.DB, opts ...gen.DOOption) noteTag {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
|
@ -287,9 +81,6 @@ func newNoteTag(db *gorm.DB, opts ...gen.DOOption) noteTag {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
||||||
|
@ -300,16 +91,8 @@ func newNoteTag(db *gorm.DB, opts ...gen.DOOption) noteTag {
|
||||||
},
|
},
|
||||||
Server: struct {
|
Server: struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
}{
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -416,72 +199,6 @@ type noteTagBelongsToNote struct {
|
||||||
|
|
||||||
field.RelationField
|
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 {
|
AttachmentRelations struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Note struct {
|
Note struct {
|
||||||
|
@ -503,9 +220,6 @@ type noteTagBelongsToNote struct {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,209 +32,6 @@ func newNoteToAttachment(db *gorm.DB, opts ...gen.DOOption) noteToAttachment {
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
RelationField: field.NewRelation("Note", "models.Note"),
|
RelationField: field.NewRelation("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("Note.Creator", "models.User"),
|
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AttachmentRelations: struct {
|
AttachmentRelations: struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Note struct {
|
Note struct {
|
||||||
|
@ -268,9 +65,6 @@ func newNoteToAttachment(db *gorm.DB, opts ...gen.DOOption) noteToAttachment {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
|
@ -287,9 +81,6 @@ func newNoteToAttachment(db *gorm.DB, opts ...gen.DOOption) noteToAttachment {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
||||||
|
@ -300,16 +91,8 @@ func newNoteToAttachment(db *gorm.DB, opts ...gen.DOOption) noteToAttachment {
|
||||||
},
|
},
|
||||||
Server: struct {
|
Server: struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
}{
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -424,72 +207,6 @@ type noteToAttachmentBelongsToNote struct {
|
||||||
|
|
||||||
field.RelationField
|
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 {
|
AttachmentRelations struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Note struct {
|
Note struct {
|
||||||
|
@ -511,9 +228,6 @@ type noteToAttachmentBelongsToNote struct {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,209 +32,6 @@ func newNoteToEmote(db *gorm.DB, opts ...gen.DOOption) noteToEmote {
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
RelationField: field.NewRelation("Note", "models.Note"),
|
RelationField: field.NewRelation("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("Note.Creator", "models.User"),
|
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AttachmentRelations: struct {
|
AttachmentRelations: struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Note struct {
|
Note struct {
|
||||||
|
@ -268,9 +65,6 @@ func newNoteToEmote(db *gorm.DB, opts ...gen.DOOption) noteToEmote {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
|
@ -287,9 +81,6 @@ func newNoteToEmote(db *gorm.DB, opts ...gen.DOOption) noteToEmote {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
||||||
|
@ -300,16 +91,8 @@ func newNoteToEmote(db *gorm.DB, opts ...gen.DOOption) noteToEmote {
|
||||||
},
|
},
|
||||||
Server: struct {
|
Server: struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
}{
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -424,72 +207,6 @@ type noteToEmoteBelongsToNote struct {
|
||||||
|
|
||||||
field.RelationField
|
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 {
|
AttachmentRelations struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Note struct {
|
Note struct {
|
||||||
|
@ -511,9 +228,6 @@ type noteToEmoteBelongsToNote struct {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,209 +32,6 @@ func newNoteToPing(db *gorm.DB, opts ...gen.DOOption) noteToPing {
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
RelationField: field.NewRelation("Note", "models.Note"),
|
RelationField: field.NewRelation("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("Note.Creator", "models.User"),
|
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AttachmentRelations: struct {
|
AttachmentRelations: struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Note struct {
|
Note struct {
|
||||||
|
@ -268,9 +65,6 @@ func newNoteToPing(db *gorm.DB, opts ...gen.DOOption) noteToPing {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
|
@ -287,9 +81,6 @@ func newNoteToPing(db *gorm.DB, opts ...gen.DOOption) noteToPing {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
||||||
|
@ -300,16 +91,8 @@ func newNoteToPing(db *gorm.DB, opts ...gen.DOOption) noteToPing {
|
||||||
},
|
},
|
||||||
Server: struct {
|
Server: struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
}{
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -424,72 +207,6 @@ type noteToPingBelongsToNote struct {
|
||||||
|
|
||||||
field.RelationField
|
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 {
|
AttachmentRelations struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Note struct {
|
Note struct {
|
||||||
|
@ -511,9 +228,6 @@ type noteToPingBelongsToNote struct {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,72 +44,6 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
||||||
RelationField: field.NewRelation("AttachmentRelations", "models.NoteToAttachment"),
|
RelationField: field.NewRelation("AttachmentRelations", "models.NoteToAttachment"),
|
||||||
Note: struct {
|
Note: struct {
|
||||||
field.RelationField
|
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 {
|
AttachmentRelations struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
}
|
}
|
||||||
|
@ -125,9 +59,6 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,209 +79,6 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
RelationField: field.NewRelation("AttachmentRelations.Note", "models.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 {
|
AttachmentRelations: struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
}{
|
}{
|
||||||
|
@ -368,9 +96,6 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
|
@ -387,9 +112,6 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
RelationField: field.NewRelation("AttachmentRelations.Note.EmoteRelations.Emote", "models.Emote"),
|
RelationField: field.NewRelation("AttachmentRelations.Note.EmoteRelations.Emote", "models.Emote"),
|
||||||
|
@ -400,16 +122,8 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
||||||
},
|
},
|
||||||
Server: struct {
|
Server: struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
}{
|
||||||
RelationField: field.NewRelation("AttachmentRelations.Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
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"),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -473,12 +187,6 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
||||||
RelationField: field.NewRelation("Tags", "models.NoteTag"),
|
RelationField: field.NewRelation("Tags", "models.NoteTag"),
|
||||||
}
|
}
|
||||||
|
|
||||||
_note.Creator = noteBelongsToCreator{
|
|
||||||
db: db.Session(&gorm.Session{}),
|
|
||||||
|
|
||||||
RelationField: field.NewRelation("Creator", "models.User"),
|
|
||||||
}
|
|
||||||
|
|
||||||
_note.fillFieldMap()
|
_note.fillFieldMap()
|
||||||
|
|
||||||
return _note
|
return _note
|
||||||
|
@ -508,8 +216,6 @@ type note struct {
|
||||||
|
|
||||||
Tags noteHasManyTags
|
Tags noteHasManyTags
|
||||||
|
|
||||||
Creator noteBelongsToCreator
|
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
fieldMap map[string]field.Expr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,7 +259,7 @@ func (n *note) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *note) fillFieldMap() {
|
func (n *note) fillFieldMap() {
|
||||||
n.fieldMap = make(map[string]field.Expr, 17)
|
n.fieldMap = make(map[string]field.Expr, 16)
|
||||||
n.fieldMap["id"] = n.ID
|
n.fieldMap["id"] = n.ID
|
||||||
n.fieldMap["created_at"] = n.CreatedAt
|
n.fieldMap["created_at"] = n.CreatedAt
|
||||||
n.fieldMap["updated_at"] = n.UpdatedAt
|
n.fieldMap["updated_at"] = n.UpdatedAt
|
||||||
|
@ -586,72 +292,6 @@ type noteHasManyAttachmentRelations struct {
|
||||||
|
|
||||||
Note struct {
|
Note struct {
|
||||||
field.RelationField
|
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 {
|
AttachmentRelations struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
}
|
}
|
||||||
|
@ -667,9 +307,6 @@ type noteHasManyAttachmentRelations struct {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -972,77 +609,6 @@ func (a noteHasManyTagsTx) Count() int64 {
|
||||||
return a.tx.Count()
|
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 noteDo struct{ gen.DO }
|
||||||
|
|
||||||
type INoteDo interface {
|
type INoteDo interface {
|
||||||
|
|
|
@ -37,209 +37,6 @@ func newReaction(db *gorm.DB, opts ...gen.DOOption) reaction {
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
RelationField: field.NewRelation("Note", "models.Note"),
|
RelationField: field.NewRelation("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("Note.Creator", "models.User"),
|
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.Creator.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AttachmentRelations: struct {
|
AttachmentRelations: struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Note struct {
|
Note struct {
|
||||||
|
@ -273,9 +70,6 @@ func newReaction(db *gorm.DB, opts ...gen.DOOption) reaction {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
|
@ -292,9 +86,6 @@ func newReaction(db *gorm.DB, opts ...gen.DOOption) reaction {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
||||||
|
@ -305,16 +96,8 @@ func newReaction(db *gorm.DB, opts ...gen.DOOption) reaction {
|
||||||
},
|
},
|
||||||
Server: struct {
|
Server: struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
}{
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -452,72 +235,6 @@ type reactionBelongsToNote struct {
|
||||||
|
|
||||||
field.RelationField
|
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 {
|
AttachmentRelations struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Note struct {
|
Note struct {
|
||||||
|
@ -539,9 +256,6 @@ type reactionBelongsToNote struct {
|
||||||
}
|
}
|
||||||
Server struct {
|
Server struct {
|
||||||
field.RelationField
|
field.RelationField
|
||||||
Icon struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,13 +33,8 @@ func newRemoteServer(db *gorm.DB, opts ...gen.DOOption) remoteServer {
|
||||||
_remoteServer.ServerType = field.NewField(tableName, "server_type")
|
_remoteServer.ServerType = field.NewField(tableName, "server_type")
|
||||||
_remoteServer.Domain = field.NewString(tableName, "domain")
|
_remoteServer.Domain = field.NewString(tableName, "domain")
|
||||||
_remoteServer.Name = field.NewString(tableName, "name")
|
_remoteServer.Name = field.NewString(tableName, "name")
|
||||||
_remoteServer.IconId = field.NewString(tableName, "icon_id")
|
_remoteServer.Icon = field.NewString(tableName, "icon")
|
||||||
_remoteServer.IsSelf = field.NewBool(tableName, "is_self")
|
_remoteServer.IsSelf = field.NewBool(tableName, "is_self")
|
||||||
_remoteServer.Icon = remoteServerBelongsToIcon{
|
|
||||||
db: db.Session(&gorm.Session{}),
|
|
||||||
|
|
||||||
RelationField: field.NewRelation("Icon", "models.MediaMetadata"),
|
|
||||||
}
|
|
||||||
|
|
||||||
_remoteServer.fillFieldMap()
|
_remoteServer.fillFieldMap()
|
||||||
|
|
||||||
|
@ -57,9 +52,8 @@ type remoteServer struct {
|
||||||
ServerType field.Field
|
ServerType field.Field
|
||||||
Domain field.String
|
Domain field.String
|
||||||
Name field.String
|
Name field.String
|
||||||
IconId field.String
|
Icon field.String
|
||||||
IsSelf field.Bool
|
IsSelf field.Bool
|
||||||
Icon remoteServerBelongsToIcon
|
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
fieldMap map[string]field.Expr
|
||||||
}
|
}
|
||||||
|
@ -83,7 +77,7 @@ func (r *remoteServer) updateTableName(table string) *remoteServer {
|
||||||
r.ServerType = field.NewField(table, "server_type")
|
r.ServerType = field.NewField(table, "server_type")
|
||||||
r.Domain = field.NewString(table, "domain")
|
r.Domain = field.NewString(table, "domain")
|
||||||
r.Name = field.NewString(table, "name")
|
r.Name = field.NewString(table, "name")
|
||||||
r.IconId = field.NewString(table, "icon_id")
|
r.Icon = field.NewString(table, "icon")
|
||||||
r.IsSelf = field.NewBool(table, "is_self")
|
r.IsSelf = field.NewBool(table, "is_self")
|
||||||
|
|
||||||
r.fillFieldMap()
|
r.fillFieldMap()
|
||||||
|
@ -101,7 +95,7 @@ func (r *remoteServer) GetFieldByName(fieldName string) (field.OrderExpr, bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *remoteServer) fillFieldMap() {
|
func (r *remoteServer) fillFieldMap() {
|
||||||
r.fieldMap = make(map[string]field.Expr, 10)
|
r.fieldMap = make(map[string]field.Expr, 9)
|
||||||
r.fieldMap["id"] = r.ID
|
r.fieldMap["id"] = r.ID
|
||||||
r.fieldMap["created_at"] = r.CreatedAt
|
r.fieldMap["created_at"] = r.CreatedAt
|
||||||
r.fieldMap["updated_at"] = r.UpdatedAt
|
r.fieldMap["updated_at"] = r.UpdatedAt
|
||||||
|
@ -109,9 +103,8 @@ func (r *remoteServer) fillFieldMap() {
|
||||||
r.fieldMap["server_type"] = r.ServerType
|
r.fieldMap["server_type"] = r.ServerType
|
||||||
r.fieldMap["domain"] = r.Domain
|
r.fieldMap["domain"] = r.Domain
|
||||||
r.fieldMap["name"] = r.Name
|
r.fieldMap["name"] = r.Name
|
||||||
r.fieldMap["icon_id"] = r.IconId
|
r.fieldMap["icon"] = r.Icon
|
||||||
r.fieldMap["is_self"] = r.IsSelf
|
r.fieldMap["is_self"] = r.IsSelf
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r remoteServer) clone(db *gorm.DB) remoteServer {
|
func (r remoteServer) clone(db *gorm.DB) remoteServer {
|
||||||
|
@ -124,77 +117,6 @@ func (r remoteServer) replaceDB(db *gorm.DB) remoteServer {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
type remoteServerBelongsToIcon struct {
|
|
||||||
db *gorm.DB
|
|
||||||
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a remoteServerBelongsToIcon) Where(conds ...field.Expr) *remoteServerBelongsToIcon {
|
|
||||||
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 remoteServerBelongsToIcon) WithContext(ctx context.Context) *remoteServerBelongsToIcon {
|
|
||||||
a.db = a.db.WithContext(ctx)
|
|
||||||
return &a
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a remoteServerBelongsToIcon) Session(session *gorm.Session) *remoteServerBelongsToIcon {
|
|
||||||
a.db = a.db.Session(session)
|
|
||||||
return &a
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a remoteServerBelongsToIcon) Model(m *models.RemoteServer) *remoteServerBelongsToIconTx {
|
|
||||||
return &remoteServerBelongsToIconTx{a.db.Model(m).Association(a.Name())}
|
|
||||||
}
|
|
||||||
|
|
||||||
type remoteServerBelongsToIconTx struct{ tx *gorm.Association }
|
|
||||||
|
|
||||||
func (a remoteServerBelongsToIconTx) Find() (result *models.MediaMetadata, err error) {
|
|
||||||
return result, a.tx.Find(&result)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a remoteServerBelongsToIconTx) Append(values ...*models.MediaMetadata) (err error) {
|
|
||||||
targetValues := make([]interface{}, len(values))
|
|
||||||
for i, v := range values {
|
|
||||||
targetValues[i] = v
|
|
||||||
}
|
|
||||||
return a.tx.Append(targetValues...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a remoteServerBelongsToIconTx) Replace(values ...*models.MediaMetadata) (err error) {
|
|
||||||
targetValues := make([]interface{}, len(values))
|
|
||||||
for i, v := range values {
|
|
||||||
targetValues[i] = v
|
|
||||||
}
|
|
||||||
return a.tx.Replace(targetValues...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a remoteServerBelongsToIconTx) Delete(values ...*models.MediaMetadata) (err error) {
|
|
||||||
targetValues := make([]interface{}, len(values))
|
|
||||||
for i, v := range values {
|
|
||||||
targetValues[i] = v
|
|
||||||
}
|
|
||||||
return a.tx.Delete(targetValues...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a remoteServerBelongsToIconTx) Clear() error {
|
|
||||||
return a.tx.Clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a remoteServerBelongsToIconTx) Count() int64 {
|
|
||||||
return a.tx.Count()
|
|
||||||
}
|
|
||||||
|
|
||||||
type remoteServerDo struct{ gen.DO }
|
type remoteServerDo struct{ gen.DO }
|
||||||
|
|
||||||
type IRemoteServerDo interface {
|
type IRemoteServerDo interface {
|
||||||
|
|
|
@ -33,141 +33,6 @@ func newUserAuthMethod(db *gorm.DB, opts ...gen.DOOption) userAuthMethod {
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
RelationField: field.NewRelation("User", "models.User"),
|
RelationField: field.NewRelation("User", "models.User"),
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_userAuthMethod.fillFieldMap()
|
_userAuthMethod.fillFieldMap()
|
||||||
|
@ -239,70 +104,6 @@ type userAuthMethodBelongsToUser struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
|
||||||
field.RelationField
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a userAuthMethodBelongsToUser) Where(conds ...field.Expr) *userAuthMethodBelongsToUser {
|
func (a userAuthMethodBelongsToUser) Where(conds ...field.Expr) *userAuthMethodBelongsToUser {
|
||||||
|
|
|
@ -39,141 +39,6 @@ func newUserInfoField(db *gorm.DB, opts ...gen.DOOption) userInfoField {
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
RelationField: field.NewRelation("User", "models.User"),
|
RelationField: field.NewRelation("User", "models.User"),
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_userInfoField.fillFieldMap()
|
_userInfoField.fillFieldMap()
|
||||||
|
@ -263,70 +128,6 @@ type userInfoFieldBelongsToUser struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
|
||||||
field.RelationField
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a userInfoFieldBelongsToUser) Where(conds ...field.Expr) *userInfoFieldBelongsToUser {
|
func (a userInfoFieldBelongsToUser) Where(conds ...field.Expr) *userInfoFieldBelongsToUser {
|
||||||
|
|
|
@ -43,141 +43,6 @@ func newUserRemoteLinks(db *gorm.DB, opts ...gen.DOOption) userRemoteLinks {
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
RelationField: field.NewRelation("User", "models.User"),
|
RelationField: field.NewRelation("User", "models.User"),
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_userRemoteLinks.fillFieldMap()
|
_userRemoteLinks.fillFieldMap()
|
||||||
|
@ -279,70 +144,6 @@ type userRemoteLinksBelongsToUser struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
|
||||||
field.RelationField
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a userRemoteLinksBelongsToUser) Where(conds ...field.Expr) *userRemoteLinksBelongsToUser {
|
func (a userRemoteLinksBelongsToUser) Where(conds ...field.Expr) *userRemoteLinksBelongsToUser {
|
||||||
|
|
|
@ -32,141 +32,6 @@ func newUserToBeing(db *gorm.DB, opts ...gen.DOOption) userToBeing {
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
RelationField: field.NewRelation("User", "models.User"),
|
RelationField: field.NewRelation("User", "models.User"),
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_userToBeing.fillFieldMap()
|
_userToBeing.fillFieldMap()
|
||||||
|
@ -235,70 +100,6 @@ type userToBeingBelongsToUser struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
|
||||||
field.RelationField
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a userToBeingBelongsToUser) Where(conds ...field.Expr) *userToBeingBelongsToUser {
|
func (a userToBeingBelongsToUser) Where(conds ...field.Expr) *userToBeingBelongsToUser {
|
||||||
|
|
|
@ -1,660 +0,0 @@
|
||||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
||||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
||||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package dbgen
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
"gorm.io/gorm/clause"
|
|
||||||
"gorm.io/gorm/schema"
|
|
||||||
|
|
||||||
"gorm.io/gen"
|
|
||||||
"gorm.io/gen/field"
|
|
||||||
|
|
||||||
"gorm.io/plugin/dbresolver"
|
|
||||||
)
|
|
||||||
|
|
||||||
func newUserToPronoun(db *gorm.DB, opts ...gen.DOOption) userToPronoun {
|
|
||||||
_userToPronoun := userToPronoun{}
|
|
||||||
|
|
||||||
_userToPronoun.userToPronounDo.UseDB(db, opts...)
|
|
||||||
_userToPronoun.userToPronounDo.UseModel(&models.UserToPronoun{})
|
|
||||||
|
|
||||||
tableName := _userToPronoun.userToPronounDo.TableName()
|
|
||||||
_userToPronoun.ALL = field.NewAsterisk(tableName)
|
|
||||||
_userToPronoun.UserId = field.NewString(tableName, "user_id")
|
|
||||||
_userToPronoun.Pronoung = field.NewString(tableName, "pronoung")
|
|
||||||
_userToPronoun.User = userToPronounBelongsToUser{
|
|
||||||
db: db.Session(&gorm.Session{}),
|
|
||||||
|
|
||||||
RelationField: field.NewRelation("User", "models.User"),
|
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
_userToPronoun.fillFieldMap()
|
|
||||||
|
|
||||||
return _userToPronoun
|
|
||||||
}
|
|
||||||
|
|
||||||
type userToPronoun struct {
|
|
||||||
userToPronounDo
|
|
||||||
|
|
||||||
ALL field.Asterisk
|
|
||||||
UserId field.String
|
|
||||||
Pronoung field.String
|
|
||||||
User userToPronounBelongsToUser
|
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronoun) Table(newTableName string) *userToPronoun {
|
|
||||||
u.userToPronounDo.UseTable(newTableName)
|
|
||||||
return u.updateTableName(newTableName)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronoun) As(alias string) *userToPronoun {
|
|
||||||
u.userToPronounDo.DO = *(u.userToPronounDo.As(alias).(*gen.DO))
|
|
||||||
return u.updateTableName(alias)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *userToPronoun) updateTableName(table string) *userToPronoun {
|
|
||||||
u.ALL = field.NewAsterisk(table)
|
|
||||||
u.UserId = field.NewString(table, "user_id")
|
|
||||||
u.Pronoung = field.NewString(table, "pronoung")
|
|
||||||
|
|
||||||
u.fillFieldMap()
|
|
||||||
|
|
||||||
return u
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *userToPronoun) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|
||||||
_f, ok := u.fieldMap[fieldName]
|
|
||||||
if !ok || _f == nil {
|
|
||||||
return nil, false
|
|
||||||
}
|
|
||||||
_oe, ok := _f.(field.OrderExpr)
|
|
||||||
return _oe, ok
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *userToPronoun) fillFieldMap() {
|
|
||||||
u.fieldMap = make(map[string]field.Expr, 3)
|
|
||||||
u.fieldMap["user_id"] = u.UserId
|
|
||||||
u.fieldMap["pronoung"] = u.Pronoung
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronoun) clone(db *gorm.DB) userToPronoun {
|
|
||||||
u.userToPronounDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
||||||
return u
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronoun) replaceDB(db *gorm.DB) userToPronoun {
|
|
||||||
u.userToPronounDo.ReplaceDB(db)
|
|
||||||
return u
|
|
||||||
}
|
|
||||||
|
|
||||||
type userToPronounBelongsToUser struct {
|
|
||||||
db *gorm.DB
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a userToPronounBelongsToUser) Where(conds ...field.Expr) *userToPronounBelongsToUser {
|
|
||||||
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 userToPronounBelongsToUser) WithContext(ctx context.Context) *userToPronounBelongsToUser {
|
|
||||||
a.db = a.db.WithContext(ctx)
|
|
||||||
return &a
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a userToPronounBelongsToUser) Session(session *gorm.Session) *userToPronounBelongsToUser {
|
|
||||||
a.db = a.db.Session(session)
|
|
||||||
return &a
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a userToPronounBelongsToUser) Model(m *models.UserToPronoun) *userToPronounBelongsToUserTx {
|
|
||||||
return &userToPronounBelongsToUserTx{a.db.Model(m).Association(a.Name())}
|
|
||||||
}
|
|
||||||
|
|
||||||
type userToPronounBelongsToUserTx struct{ tx *gorm.Association }
|
|
||||||
|
|
||||||
func (a userToPronounBelongsToUserTx) Find() (result *models.User, err error) {
|
|
||||||
return result, a.tx.Find(&result)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a userToPronounBelongsToUserTx) 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 userToPronounBelongsToUserTx) 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 userToPronounBelongsToUserTx) 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 userToPronounBelongsToUserTx) Clear() error {
|
|
||||||
return a.tx.Clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a userToPronounBelongsToUserTx) Count() int64 {
|
|
||||||
return a.tx.Count()
|
|
||||||
}
|
|
||||||
|
|
||||||
type userToPronounDo struct{ gen.DO }
|
|
||||||
|
|
||||||
type IUserToPronounDo interface {
|
|
||||||
gen.SubQuery
|
|
||||||
Debug() IUserToPronounDo
|
|
||||||
WithContext(ctx context.Context) IUserToPronounDo
|
|
||||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
|
||||||
ReplaceDB(db *gorm.DB)
|
|
||||||
ReadDB() IUserToPronounDo
|
|
||||||
WriteDB() IUserToPronounDo
|
|
||||||
As(alias string) gen.Dao
|
|
||||||
Session(config *gorm.Session) IUserToPronounDo
|
|
||||||
Columns(cols ...field.Expr) gen.Columns
|
|
||||||
Clauses(conds ...clause.Expression) IUserToPronounDo
|
|
||||||
Not(conds ...gen.Condition) IUserToPronounDo
|
|
||||||
Or(conds ...gen.Condition) IUserToPronounDo
|
|
||||||
Select(conds ...field.Expr) IUserToPronounDo
|
|
||||||
Where(conds ...gen.Condition) IUserToPronounDo
|
|
||||||
Order(conds ...field.Expr) IUserToPronounDo
|
|
||||||
Distinct(cols ...field.Expr) IUserToPronounDo
|
|
||||||
Omit(cols ...field.Expr) IUserToPronounDo
|
|
||||||
Join(table schema.Tabler, on ...field.Expr) IUserToPronounDo
|
|
||||||
LeftJoin(table schema.Tabler, on ...field.Expr) IUserToPronounDo
|
|
||||||
RightJoin(table schema.Tabler, on ...field.Expr) IUserToPronounDo
|
|
||||||
Group(cols ...field.Expr) IUserToPronounDo
|
|
||||||
Having(conds ...gen.Condition) IUserToPronounDo
|
|
||||||
Limit(limit int) IUserToPronounDo
|
|
||||||
Offset(offset int) IUserToPronounDo
|
|
||||||
Count() (count int64, err error)
|
|
||||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IUserToPronounDo
|
|
||||||
Unscoped() IUserToPronounDo
|
|
||||||
Create(values ...*models.UserToPronoun) error
|
|
||||||
CreateInBatches(values []*models.UserToPronoun, batchSize int) error
|
|
||||||
Save(values ...*models.UserToPronoun) error
|
|
||||||
First() (*models.UserToPronoun, error)
|
|
||||||
Take() (*models.UserToPronoun, error)
|
|
||||||
Last() (*models.UserToPronoun, error)
|
|
||||||
Find() ([]*models.UserToPronoun, error)
|
|
||||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.UserToPronoun, err error)
|
|
||||||
FindInBatches(result *[]*models.UserToPronoun, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
|
||||||
Pluck(column field.Expr, dest interface{}) error
|
|
||||||
Delete(...*models.UserToPronoun) (info gen.ResultInfo, err error)
|
|
||||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
|
||||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
|
||||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
|
||||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
|
||||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
|
||||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
|
||||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
|
||||||
Attrs(attrs ...field.AssignExpr) IUserToPronounDo
|
|
||||||
Assign(attrs ...field.AssignExpr) IUserToPronounDo
|
|
||||||
Joins(fields ...field.RelationField) IUserToPronounDo
|
|
||||||
Preload(fields ...field.RelationField) IUserToPronounDo
|
|
||||||
FirstOrInit() (*models.UserToPronoun, error)
|
|
||||||
FirstOrCreate() (*models.UserToPronoun, error)
|
|
||||||
FindByPage(offset int, limit int) (result []*models.UserToPronoun, count int64, err error)
|
|
||||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
|
||||||
Scan(result interface{}) (err error)
|
|
||||||
Returning(value interface{}, columns ...string) IUserToPronounDo
|
|
||||||
UnderlyingDB() *gorm.DB
|
|
||||||
schema.Tabler
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Debug() IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Debug())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) WithContext(ctx context.Context) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.WithContext(ctx))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) ReadDB() IUserToPronounDo {
|
|
||||||
return u.Clauses(dbresolver.Read)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) WriteDB() IUserToPronounDo {
|
|
||||||
return u.Clauses(dbresolver.Write)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Session(config *gorm.Session) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Session(config))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Clauses(conds ...clause.Expression) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Clauses(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Returning(value interface{}, columns ...string) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Returning(value, columns...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Not(conds ...gen.Condition) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Not(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Or(conds ...gen.Condition) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Or(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Select(conds ...field.Expr) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Select(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Where(conds ...gen.Condition) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Where(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Order(conds ...field.Expr) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Order(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Distinct(cols ...field.Expr) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Distinct(cols...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Omit(cols ...field.Expr) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Omit(cols...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Join(table schema.Tabler, on ...field.Expr) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Join(table, on...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) LeftJoin(table schema.Tabler, on ...field.Expr) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.LeftJoin(table, on...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) RightJoin(table schema.Tabler, on ...field.Expr) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.RightJoin(table, on...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Group(cols ...field.Expr) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Group(cols...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Having(conds ...gen.Condition) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Having(conds...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Limit(limit int) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Limit(limit))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Offset(offset int) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Offset(offset))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Scopes(funcs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Unscoped() IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Unscoped())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Create(values ...*models.UserToPronoun) error {
|
|
||||||
if len(values) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return u.DO.Create(values)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) CreateInBatches(values []*models.UserToPronoun, batchSize int) error {
|
|
||||||
return u.DO.CreateInBatches(values, batchSize)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save : !!! underlying implementation is different with GORM
|
|
||||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
|
||||||
func (u userToPronounDo) Save(values ...*models.UserToPronoun) error {
|
|
||||||
if len(values) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return u.DO.Save(values)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) First() (*models.UserToPronoun, error) {
|
|
||||||
if result, err := u.DO.First(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.UserToPronoun), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Take() (*models.UserToPronoun, error) {
|
|
||||||
if result, err := u.DO.Take(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.UserToPronoun), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Last() (*models.UserToPronoun, error) {
|
|
||||||
if result, err := u.DO.Last(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.UserToPronoun), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Find() ([]*models.UserToPronoun, error) {
|
|
||||||
result, err := u.DO.Find()
|
|
||||||
return result.([]*models.UserToPronoun), err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.UserToPronoun, err error) {
|
|
||||||
buf := make([]*models.UserToPronoun, 0, batchSize)
|
|
||||||
err = u.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
|
||||||
defer func() { results = append(results, buf...) }()
|
|
||||||
return fc(tx, batch)
|
|
||||||
})
|
|
||||||
return results, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) FindInBatches(result *[]*models.UserToPronoun, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
||||||
return u.DO.FindInBatches(result, batchSize, fc)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Attrs(attrs ...field.AssignExpr) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Attrs(attrs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Assign(attrs ...field.AssignExpr) IUserToPronounDo {
|
|
||||||
return u.withDO(u.DO.Assign(attrs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Joins(fields ...field.RelationField) IUserToPronounDo {
|
|
||||||
for _, _f := range fields {
|
|
||||||
u = *u.withDO(u.DO.Joins(_f))
|
|
||||||
}
|
|
||||||
return &u
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Preload(fields ...field.RelationField) IUserToPronounDo {
|
|
||||||
for _, _f := range fields {
|
|
||||||
u = *u.withDO(u.DO.Preload(_f))
|
|
||||||
}
|
|
||||||
return &u
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) FirstOrInit() (*models.UserToPronoun, error) {
|
|
||||||
if result, err := u.DO.FirstOrInit(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.UserToPronoun), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) FirstOrCreate() (*models.UserToPronoun, error) {
|
|
||||||
if result, err := u.DO.FirstOrCreate(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else {
|
|
||||||
return result.(*models.UserToPronoun), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) FindByPage(offset int, limit int) (result []*models.UserToPronoun, count int64, err error) {
|
|
||||||
result, err = u.Offset(offset).Limit(limit).Find()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
|
||||||
count = int64(size + offset)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
count, err = u.Offset(-1).Limit(-1).Count()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
|
||||||
count, err = u.Count()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
err = u.Offset(offset).Limit(limit).Scan(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Scan(result interface{}) (err error) {
|
|
||||||
return u.DO.Scan(result)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u userToPronounDo) Delete(models ...*models.UserToPronoun) (result gen.ResultInfo, err error) {
|
|
||||||
return u.DO.Delete(models)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *userToPronounDo) withDO(do gen.Dao) *userToPronounDo {
|
|
||||||
u.DO = *do.(*gen.DO)
|
|
||||||
return u
|
|
||||||
}
|
|
|
@ -32,141 +32,6 @@ func newUserToRole(db *gorm.DB, opts ...gen.DOOption) userToRole {
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
RelationField: field.NewRelation("User", "models.User"),
|
RelationField: field.NewRelation("User", "models.User"),
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_userToRole.Role = userToRoleBelongsToRole{
|
_userToRole.Role = userToRoleBelongsToRole{
|
||||||
|
@ -243,70 +108,6 @@ type userToRoleBelongsToUser struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
|
||||||
field.RelationField
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a userToRoleBelongsToUser) Where(conds ...field.Expr) *userToRoleBelongsToUser {
|
func (a userToRoleBelongsToUser) Where(conds ...field.Expr) *userToRoleBelongsToUser {
|
||||||
|
|
|
@ -32,141 +32,6 @@ func newUserToTag(db *gorm.DB, opts ...gen.DOOption) userToTag {
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
RelationField: field.NewRelation("User", "models.User"),
|
RelationField: field.NewRelation("User", "models.User"),
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_userToTag.fillFieldMap()
|
_userToTag.fillFieldMap()
|
||||||
|
@ -235,70 +100,6 @@ type userToTagBelongsToUser struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
|
||||||
field.RelationField
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a userToTagBelongsToUser) Where(conds ...field.Expr) *userToTagBelongsToUser {
|
func (a userToTagBelongsToUser) Where(conds ...field.Expr) *userToTagBelongsToUser {
|
||||||
|
|
|
@ -33,141 +33,6 @@ func newUserToUserRelation(db *gorm.DB, opts ...gen.DOOption) userToUserRelation
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
RelationField: field.NewRelation("User", "models.User"),
|
RelationField: field.NewRelation("User", "models.User"),
|
||||||
Icon: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Background: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
Banner: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
|
||||||
},
|
|
||||||
RemoteInfo: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
InfoFields: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
BeingTypes: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tags: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Relations: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
TargetUser struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
|
||||||
},
|
|
||||||
TargetUser: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Pronouns: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Roles: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
Role struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
|
||||||
},
|
|
||||||
Role: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
AuthMethods: struct {
|
|
||||||
field.RelationField
|
|
||||||
User struct {
|
|
||||||
field.RelationField
|
|
||||||
}
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
|
||||||
User: struct {
|
|
||||||
field.RelationField
|
|
||||||
}{
|
|
||||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_userToUserRelation.TargetUser = userToUserRelationBelongsToTargetUser{
|
_userToUserRelation.TargetUser = userToUserRelationBelongsToTargetUser{
|
||||||
|
@ -247,70 +112,6 @@ type userToUserRelationBelongsToUser struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
|
||||||
field.RelationField
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a userToUserRelationBelongsToUser) Where(conds ...field.Expr) *userToUserRelationBelongsToUser {
|
func (a userToUserRelationBelongsToUser) Where(conds ...field.Expr) *userToUserRelationBelongsToUser {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -11,8 +11,6 @@ var AllTypes = []any{
|
||||||
&Reaction{},
|
&Reaction{},
|
||||||
&RemoteServer{},
|
&RemoteServer{},
|
||||||
&Role{},
|
&Role{},
|
||||||
&AccessToken{},
|
|
||||||
&LoginProcessToken{},
|
|
||||||
&User{},
|
&User{},
|
||||||
&UserAuthMethod{},
|
&UserAuthMethod{},
|
||||||
&UserToBeing{},
|
&UserToBeing{},
|
||||||
|
@ -20,6 +18,5 @@ var AllTypes = []any{
|
||||||
&UserToUserRelation{},
|
&UserToUserRelation{},
|
||||||
&UserRemoteLinks{},
|
&UserRemoteLinks{},
|
||||||
&UserToTag{},
|
&UserToTag{},
|
||||||
&UserToPronoun{},
|
|
||||||
&UserToRole{},
|
&UserToRole{},
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
// Media is, at least for Linstrom, always stored on a separate server,
|
// Media is, at least for Linstrom, always stored on a separate server,
|
||||||
// be that the remote server it originated from or an s3 bucket
|
// be that the remote server it originated from or an s3 bucket
|
||||||
type MediaMetadata struct {
|
type MediaMetadata struct {
|
||||||
ID string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"` // The unique ID of this media file
|
ID string `gorm:"primarykey"` // The unique ID of this media file
|
||||||
CreatedAt time.Time // When this entry was created
|
CreatedAt time.Time // When this entry was created
|
||||||
UpdatedAt time.Time // When this entry was last updated
|
UpdatedAt time.Time // When this entry was last updated
|
||||||
// When this entry was deleted (for soft deletions)
|
// When this entry was deleted (for soft deletions)
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
// - Pings: models.NoteToPing
|
// - Pings: models.NoteToPing
|
||||||
// - Tags: models.NoteTag
|
// - Tags: models.NoteTag
|
||||||
type Note struct {
|
type Note struct {
|
||||||
ID string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"` // Make ID a string (uuid) for other implementations
|
ID string `gorm:"primarykey"` // Make ID a string (uuid) for other implementations
|
||||||
CreatedAt time.Time // When this entry was created
|
CreatedAt time.Time // When this entry was created
|
||||||
UpdatedAt time.Time // When this entry was last updated
|
UpdatedAt time.Time // When this entry was last updated
|
||||||
// When this entry was deleted (for soft deletions)
|
// When this entry was deleted (for soft deletions)
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
package models
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"gorm.io/gen"
|
|
||||||
)
|
|
||||||
|
|
||||||
type AccessToken struct {
|
|
||||||
User User
|
|
||||||
UserId string
|
|
||||||
Token string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"`
|
|
||||||
Name string // Token name will be empty if autogenerated with sucessful login
|
|
||||||
// Every token expires, even if set to "not expire". If set to "not expire", it just expires
|
|
||||||
// at a point in the future this server should never reach
|
|
||||||
ExpiresAt time.Time `gorm:"default:TIMESTAMP WITH TIME ZONE '9999-12-30 23:59:59+00'"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type IAccessToken interface {
|
|
||||||
// INSERT INTO @@table (user_id, token, name, {{if expiresAt != nil}}, )
|
|
||||||
NewToken(user *User, name string, expiresAt *time.Time) (gen.T, error)
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
package models
|
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
// A token used during the login process
|
|
||||||
// Each user may only have at most one login process active at the same time
|
|
||||||
type LoginProcessToken struct {
|
|
||||||
User User
|
|
||||||
UserId string
|
|
||||||
Token string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"`
|
|
||||||
ExpiresAt time.Time
|
|
||||||
}
|
|
|
@ -30,6 +30,7 @@ type User struct {
|
||||||
// identifier for users and other servers, especially when changing the username
|
// identifier for users and other servers, especially when changing the username
|
||||||
// (username != display name) might be a future feature
|
// (username != display name) might be a future feature
|
||||||
// Same also applies for other types that use a UUID as primary key
|
// Same also applies for other types that use a UUID as primary key
|
||||||
|
// TODO: Copy the default value and gorm type to those other types as well
|
||||||
ID string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"`
|
ID string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"`
|
||||||
// Username of the user (eg "max" if the full username is @max@example.com)
|
// Username of the user (eg "max" if the full username is @max@example.com)
|
||||||
// Assume unchangable (once set by a user) to be kind to other implementations
|
// Assume unchangable (once set by a user) to be kind to other implementations
|
||||||
|
@ -62,22 +63,9 @@ type User struct {
|
||||||
Location *string
|
Location *string
|
||||||
Birthday *time.Time
|
Birthday *time.Time
|
||||||
|
|
||||||
|
// --- And internal account stuff ---
|
||||||
// Whether the account got verified and is allowed to be active
|
// Whether the account got verified and is allowed to be active
|
||||||
// For local accounts being active means being allowed to login and perform interactions
|
// For local accounts being active means being allowed to login and perform interactions
|
||||||
// For remote users, if an account is not verified, any interactions it sends are discarded
|
// For remote users, if an account is not verified, any interactions it sends are discarded
|
||||||
Verified bool
|
Verified bool
|
||||||
// 64 byte unique id for passkeys, because UUIDs are 128 bytes and passkey spec says 64 bytes max
|
|
||||||
// In theory, could also slash Id in half, but that would be a lot more calculations than the
|
|
||||||
// saved space is worth
|
|
||||||
PasskeyId []byte
|
|
||||||
|
|
||||||
// ---- "Remote" linked values
|
|
||||||
InfoFields []UserInfoField
|
|
||||||
BeingTypes []UserToBeing
|
|
||||||
Tags []UserToTag
|
|
||||||
Relations []UserToUserRelation
|
|
||||||
Pronouns []UserToPronoun
|
|
||||||
Roles []UserToRole
|
|
||||||
RemoteInfo *UserRemoteLinks
|
|
||||||
AuthMethods []UserAuthMethod
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@ package models
|
||||||
// For a password, this would be a hash of that password,
|
// For a password, this would be a hash of that password,
|
||||||
// totp would be the seed,
|
// totp would be the seed,
|
||||||
// and passkey would be the webauthn.Credential, marshalled into json
|
// and passkey would be the webauthn.Credential, marshalled into json
|
||||||
//
|
|
||||||
// Password hashes may only exist at most once per user, the rest 0-m
|
|
||||||
type UserAuthMethod struct {
|
type UserAuthMethod struct {
|
||||||
User User
|
User User
|
||||||
UserId string
|
UserId string
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
package models
|
|
||||||
|
|
||||||
type UserToPronoun struct {
|
|
||||||
User User
|
|
||||||
UserId string
|
|
||||||
Pronoung string
|
|
||||||
}
|
|
Loading…
Reference in a new issue