kopia lustrzana https://github.com/reiver/greatape
feat(components): ✨ update repositories based on new default db driver
rodzic
4b77023314
commit
0697a83e00
|
@ -20,8 +20,8 @@ func InitializeAccessControlEntity() {
|
|||
|
||||
type accessControlEntity struct {
|
||||
entity
|
||||
KeyField uint64 `json:"key" previous:"id" storage:"BIGINT UNSIGNED" default:"0"`
|
||||
ValueField uint64 `json:"value" previous:"key" storage:"BIGINT UNSIGNED" default:"0"`
|
||||
KeyField uint64 `json:"key" storage:"BIGINT" default:"0"`
|
||||
ValueField uint64 `json:"value" storage:"BIGINT" default:"0"`
|
||||
}
|
||||
|
||||
func NewAccessControlEntity(id int64, key uint64, value uint64) IAccessControlEntity {
|
||||
|
|
|
@ -20,11 +20,11 @@ func InitializeActivityPubFollowerEntity() {
|
|||
|
||||
type activityPubFollowerEntity struct {
|
||||
entity
|
||||
HandleField string `json:"handle" previous:"id" storage:"VARCHAR(256)" default:"''"`
|
||||
InboxField string `json:"inbox" previous:"handle" storage:"VARCHAR(256)" default:"''"`
|
||||
SubjectField string `json:"subject" previous:"inbox" storage:"VARCHAR(256)" default:"''"`
|
||||
ActivityField string `json:"activity" previous:"subject" storage:"VARCHAR(4096)" default:"''"`
|
||||
AcceptedField bool `json:"accepted" previous:"activity" storage:"BIT(1)" default:"FALSE"`
|
||||
HandleField string `json:"handle" storage:"VARCHAR(256)" default:"''"`
|
||||
InboxField string `json:"inbox" storage:"VARCHAR(256)" default:"''"`
|
||||
SubjectField string `json:"subject" storage:"VARCHAR(256)" default:"''"`
|
||||
ActivityField string `json:"activity" storage:"VARCHAR(4096)" default:"''"`
|
||||
AcceptedField bool `json:"accepted" storage:"BOOLEAN" default:"FALSE"`
|
||||
}
|
||||
|
||||
func NewActivityPubFollowerEntity(id int64, handle string, inbox string, subject string, activity string, accepted bool) IActivityPubFollowerEntity {
|
||||
|
|
|
@ -21,12 +21,12 @@ func InitializeActivityPubIncomingActivityEntity() {
|
|||
type activityPubIncomingActivityEntity struct {
|
||||
entity
|
||||
IdentityIdField int64 `json:"identity_id"`
|
||||
UniqueIdentifierField string `json:"unique_identifier" previous:"identity_id" storage:"VARCHAR(128)" default:"''"`
|
||||
TimestampField int64 `json:"timestamp" previous:"unique_identifier" storage:"BIGINT" default:"0"`
|
||||
FromField string `json:"from" previous:"timestamp" storage:"VARCHAR(256)" default:"''"`
|
||||
ToField string `json:"to" previous:"from" storage:"VARCHAR(256)" default:"''"`
|
||||
ContentField string `json:"content" previous:"to" storage:"VARCHAR(4096)" default:"''"`
|
||||
RawField string `json:"raw" previous:"content" storage:"JSON" default:"'{}'"`
|
||||
UniqueIdentifierField string `json:"unique_identifier" storage:"VARCHAR(128)" default:"''"`
|
||||
TimestampField int64 `json:"timestamp" storage:"BIGINT" default:"0"`
|
||||
FromField string `json:"from" storage:"VARCHAR(256)" default:"''"`
|
||||
ToField string `json:"to" storage:"VARCHAR(256)" default:"''"`
|
||||
ContentField string `json:"content" storage:"VARCHAR(4096)" default:"''"`
|
||||
RawField string `json:"raw" storage:"JSONB" default:"'{}'"`
|
||||
}
|
||||
|
||||
func NewActivityPubIncomingActivityEntity(id int64, identityId int64, uniqueIdentifier string, timestamp int64, from string, to string, content string, raw string) IActivityPubIncomingActivityEntity {
|
||||
|
|
|
@ -21,12 +21,12 @@ func InitializeActivityPubOutgoingActivityEntity() {
|
|||
type activityPubOutgoingActivityEntity struct {
|
||||
entity
|
||||
IdentityIdField int64 `json:"identity_id"`
|
||||
UniqueIdentifierField string `json:"unique_identifier" previous:"identity_id" storage:"VARCHAR(128)" default:"''"`
|
||||
TimestampField int64 `json:"timestamp" previous:"unique_identifier" storage:"BIGINT" default:"0"`
|
||||
FromField string `json:"from" previous:"timestamp" storage:"VARCHAR(256)" default:"''"`
|
||||
ToField string `json:"to" previous:"from" storage:"VARCHAR(256)" default:"''"`
|
||||
ContentField string `json:"content" previous:"to" storage:"VARCHAR(4096)" default:"''"`
|
||||
RawField string `json:"raw" previous:"content" storage:"JSON" default:"'{}'"`
|
||||
UniqueIdentifierField string `json:"unique_identifier" storage:"VARCHAR(128)" default:"''"`
|
||||
TimestampField int64 `json:"timestamp" storage:"BIGINT" default:"0"`
|
||||
FromField string `json:"from" storage:"VARCHAR(256)" default:"''"`
|
||||
ToField string `json:"to" storage:"VARCHAR(256)" default:"''"`
|
||||
ContentField string `json:"content" storage:"VARCHAR(4096)" default:"''"`
|
||||
RawField string `json:"raw" storage:"JSONB" default:"'{}'"`
|
||||
}
|
||||
|
||||
func NewActivityPubOutgoingActivityEntity(id int64, identityId int64, uniqueIdentifier string, timestamp int64, from string, to string, content string, raw string) IActivityPubOutgoingActivityEntity {
|
||||
|
|
|
@ -22,8 +22,8 @@ type categoryEntity struct {
|
|||
entity
|
||||
CategoryTypeIdField int64 `json:"category_type_id"`
|
||||
CategoryIdField int64 `json:"category_id"`
|
||||
TitleField string `json:"title" previous:"category_id" storage:"VARCHAR(64)" default:"''"`
|
||||
DescriptionField string `json:"description" previous:"title" storage:"VARCHAR(64)" default:"''"`
|
||||
TitleField string `json:"title" storage:"VARCHAR(64)" default:"''"`
|
||||
DescriptionField string `json:"description" storage:"VARCHAR(64)" default:"''"`
|
||||
}
|
||||
|
||||
func NewCategoryEntity(id int64, categoryTypeId int64, categoryId int64, title string, description string) ICategoryEntity {
|
||||
|
|
|
@ -20,7 +20,7 @@ func InitializeCategoryTypeEntity() {
|
|||
|
||||
type categoryTypeEntity struct {
|
||||
entity
|
||||
DescriptionField string `json:"description" previous:"id" storage:"VARCHAR(64)" default:"''"`
|
||||
DescriptionField string `json:"description" storage:"VARCHAR(64)" default:"''"`
|
||||
}
|
||||
|
||||
func NewCategoryTypeEntity(id int64, description string) ICategoryTypeEntity {
|
||||
|
|
|
@ -20,7 +20,7 @@ func InitializeDocumentEntity() {
|
|||
|
||||
type documentEntity struct {
|
||||
entity
|
||||
ContentField string `json:"content" previous:"id" storage:"JSON" default:"'{}'"`
|
||||
ContentField string `json:"content" storage:"JSONB" default:"'{}'"`
|
||||
}
|
||||
|
||||
func NewDocumentEntity(id int64, content string) IDocumentEntity {
|
||||
|
|
|
@ -20,27 +20,27 @@ func InitializeIdentityEntity() {
|
|||
|
||||
type identityEntity struct {
|
||||
entity
|
||||
UsernameField string `json:"username" previous:"id" storage:"VARCHAR(32)" default:"''"`
|
||||
PhoneNumberField string `json:"phone_number" previous:"username" storage:"VARCHAR(12)" default:"''"`
|
||||
PhoneNumberConfirmedField bool `json:"phone_number_confirmed" previous:"phone_number" storage:"BIT(1)" default:"FALSE"`
|
||||
FirstNameField string `json:"first_name" previous:"phone_number_confirmed" storage:"VARCHAR(128)" default:"''"`
|
||||
LastNameField string `json:"last_name" previous:"first_name" storage:"VARCHAR(128)" default:"''"`
|
||||
DisplayNameField string `json:"display_name" previous:"last_name" storage:"VARCHAR(128)" default:"''"`
|
||||
EmailField string `json:"email" previous:"display_name" storage:"VARCHAR(128)" default:"''"`
|
||||
EmailConfirmedField bool `json:"email_confirmed" previous:"email" storage:"BIT(1)" default:"FALSE"`
|
||||
AvatarField string `json:"avatar" previous:"email_confirmed" storage:"VARCHAR(512)" default:"''"`
|
||||
BannerField string `json:"banner" previous:"avatar" storage:"VARCHAR(512)" default:"''"`
|
||||
SummaryField string `json:"summary" previous:"banner" storage:"VARCHAR(512)" default:"''"`
|
||||
TokenField string `json:"token" previous:"summary" storage:"VARCHAR(256)" default:"''"`
|
||||
MultiFactorField bool `json:"multi_factor" previous:"token" storage:"BIT(1)" default:"FALSE"`
|
||||
HashField string `json:"hash" previous:"multi_factor" storage:"VARCHAR(256)" default:"''"`
|
||||
SaltField string `json:"salt" previous:"hash" storage:"VARCHAR(64)" default:"''"`
|
||||
PublicKeyField string `json:"public_key" previous:"salt" storage:"VARCHAR(4096)" default:"''"`
|
||||
PrivateKeyField string `json:"private_key" previous:"public_key" storage:"VARCHAR(4096)" default:"''"`
|
||||
PermissionField uint64 `json:"permission" previous:"private_key" storage:"BIGINT UNSIGNED" default:"0"`
|
||||
RestrictionField uint32 `json:"restriction" previous:"permission" storage:"INT UNSIGNED" default:"0"`
|
||||
LastLoginField int64 `json:"last_login" previous:"restriction" storage:"BIGINT" default:"0"`
|
||||
LoginCountField uint32 `json:"login_count" previous:"last_login" storage:"INT UNSIGNED" default:"0"`
|
||||
UsernameField string `json:"username" storage:"VARCHAR(32)" default:"''"`
|
||||
PhoneNumberField string `json:"phone_number" storage:"VARCHAR(12)" default:"''"`
|
||||
PhoneNumberConfirmedField bool `json:"phone_number_confirmed" storage:"BOOLEAN" default:"FALSE"`
|
||||
FirstNameField string `json:"first_name" storage:"VARCHAR(128)" default:"''"`
|
||||
LastNameField string `json:"last_name" storage:"VARCHAR(128)" default:"''"`
|
||||
DisplayNameField string `json:"display_name" storage:"VARCHAR(128)" default:"''"`
|
||||
EmailField string `json:"email" storage:"VARCHAR(128)" default:"''"`
|
||||
EmailConfirmedField bool `json:"email_confirmed" storage:"BOOLEAN" default:"FALSE"`
|
||||
AvatarField string `json:"avatar" storage:"VARCHAR(512)" default:"''"`
|
||||
BannerField string `json:"banner" storage:"VARCHAR(512)" default:"''"`
|
||||
SummaryField string `json:"summary" storage:"VARCHAR(512)" default:"''"`
|
||||
TokenField string `json:"token" storage:"VARCHAR(256)" default:"''"`
|
||||
MultiFactorField bool `json:"multi_factor" storage:"BOOLEAN" default:"FALSE"`
|
||||
HashField string `json:"hash" storage:"VARCHAR(256)" default:"''"`
|
||||
SaltField string `json:"salt" storage:"VARCHAR(64)" default:"''"`
|
||||
PublicKeyField string `json:"public_key" storage:"VARCHAR(4096)" default:"''"`
|
||||
PrivateKeyField string `json:"private_key" storage:"VARCHAR(4096)" default:"''"`
|
||||
PermissionField uint64 `json:"permission" storage:"BIGINT" default:"0"`
|
||||
RestrictionField uint32 `json:"restriction" storage:"INT" default:"0"`
|
||||
LastLoginField int64 `json:"last_login" storage:"BIGINT" default:"0"`
|
||||
LoginCountField uint32 `json:"login_count" storage:"INT" default:"0"`
|
||||
}
|
||||
|
||||
func NewIdentityEntity(id int64, username string, phoneNumber string, phoneNumberConfirmed bool, firstName string, lastName string, displayName string, email string, emailConfirmed bool, avatar string, banner string, summary string, token string, multiFactor bool, hash string, salt string, publicKey string, privateKey string, permission uint64, restriction uint32, lastLogin int64, loginCount uint32) IIdentityEntity {
|
||||
|
|
|
@ -20,14 +20,14 @@ func InitializeRemoteActivityEntity() {
|
|||
|
||||
type remoteActivityEntity struct {
|
||||
entity
|
||||
EntryPointField string `json:"entry_point" previous:"id" storage:"VARCHAR(256)" default:"''"`
|
||||
DurationField int64 `json:"duration" previous:"entry_point" storage:"BIGINT" default:"0"`
|
||||
SuccessfulField bool `json:"successful" previous:"duration" storage:"BIT(1)" default:"FALSE"`
|
||||
ErrorMessageField string `json:"error_message" previous:"successful" storage:"VARCHAR(1024)" default:"''"`
|
||||
RemoteAddressField string `json:"remote_address" previous:"error_message" storage:"VARCHAR(128)" default:"''"`
|
||||
UserAgentField string `json:"user_agent" previous:"remote_address" storage:"VARCHAR(512)" default:"''"`
|
||||
EventTypeField uint32 `json:"event_type" previous:"user_agent" storage:"INT UNSIGNED" default:"0"`
|
||||
TimestampField int64 `json:"timestamp" previous:"event_type" storage:"BIGINT" default:"0"`
|
||||
EntryPointField string `json:"entry_point" storage:"VARCHAR(256)" default:"''"`
|
||||
DurationField int64 `json:"duration" storage:"BIGINT" default:"0"`
|
||||
SuccessfulField bool `json:"successful" storage:"BOOLEAN" default:"FALSE"`
|
||||
ErrorMessageField string `json:"error_message" storage:"VARCHAR(1024)" default:"''"`
|
||||
RemoteAddressField string `json:"remote_address" storage:"VARCHAR(128)" default:"''"`
|
||||
UserAgentField string `json:"user_agent" storage:"VARCHAR(512)" default:"''"`
|
||||
EventTypeField uint32 `json:"event_type" storage:"INT" default:"0"`
|
||||
TimestampField int64 `json:"timestamp" storage:"BIGINT" default:"0"`
|
||||
}
|
||||
|
||||
func NewRemoteActivityEntity(id int64, entryPoint string, duration int64, successful bool, errorMessage string, remoteAddress string, userAgent string, eventType uint32, timestamp int64) IRemoteActivityEntity {
|
||||
|
|
|
@ -20,8 +20,8 @@ func InitializeSystemScheduleEntity() {
|
|||
|
||||
type systemScheduleEntity struct {
|
||||
entity
|
||||
EnabledField bool `json:"enabled" previous:"id" storage:"BIT(1)" default:"FALSE"`
|
||||
ConfigField string `json:"config" previous:"enabled" storage:"VARCHAR(1024)" default:"''"`
|
||||
EnabledField bool `json:"enabled" storage:"BOOLEAN" default:"FALSE"`
|
||||
ConfigField string `json:"config" storage:"VARCHAR(1024)" default:"''"`
|
||||
}
|
||||
|
||||
func NewSystemScheduleEntity(id int64, enabled bool, config string) ISystemScheduleEntity {
|
||||
|
|
|
@ -20,7 +20,7 @@ func InitializeUserEntity() {
|
|||
|
||||
type userEntity struct {
|
||||
entity
|
||||
GithubField string `json:"github" previous:"id" storage:"VARCHAR(512)" default:"''"`
|
||||
GithubField string `json:"github" storage:"VARCHAR(512)" default:"''"`
|
||||
}
|
||||
|
||||
func NewUserEntity(id int64, github string) IUserEntity {
|
||||
|
|
|
@ -24,7 +24,7 @@ func (repository *accessControlsRepository) Add(entity IAccessControlEntity, edi
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `access_controls` (`id`, `key`, `value`, `editor`) VALUES (?, ?, ?, ?);"
|
||||
query := `INSERT INTO "access_controls" ("id", "key", "value", "editor") VALUES ($1, $2, $3, $4);`
|
||||
return repository.database.InsertSingle(query, entity.Id(), entity.Key(), entity.Value(), editor)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ func (repository *accessControlsRepository) AddAtomic(transaction IRepositoryTra
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `access_controls` (`id`, `key`, `value`, `editor`) VALUES (?, ?, ?, ?);"
|
||||
query := `INSERT INTO "access_controls" ("id", "key", "value", "editor") VALUES ($1, $2, $3, $4);`
|
||||
return repository.database.InsertSingleAtomic(transaction, query, entity.Id(), entity.Key(), entity.Value(), editor)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ func (repository *accessControlsRepository) FetchById(id int64) (IAccessControlE
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `key`, `value` FROM `access_controls` WHERE `id` = ? AND `status` = 0;"
|
||||
query := `SELECT "id", "key", "value" FROM "access_controls" WHERE "id" = $1 AND "status" = 0;`
|
||||
|
||||
var accessControlEntity IAccessControlEntity
|
||||
if err := repository.database.QuerySingle(func(cursor ICursor) error {
|
||||
|
@ -73,7 +73,7 @@ func (repository *accessControlsRepository) Update(entity IAccessControlEntity,
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `access_controls` SET `key` = ?, `value` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "access_controls" SET "key" = $1, "value" = $2, "editor" = $3 WHERE "id" = $4;`
|
||||
return repository.database.UpdateSingle(query, entity.Key(), entity.Value(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ func (repository *accessControlsRepository) UpdateAtomic(transaction IRepository
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `access_controls` SET `key` = ?, `value` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "access_controls" SET "key" = $1, "value" = $2, "editor" = $3 WHERE "id" = $4;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, entity.Key(), entity.Value(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ func (repository *accessControlsRepository) Remove(entity IAccessControlEntity,
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `access_controls` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "access_controls" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingle(query, editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -103,13 +103,13 @@ func (repository *accessControlsRepository) RemoveAtomic(transaction IRepository
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `access_controls` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "access_controls" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingleAtomic(transaction, query, editor, entity.Id())
|
||||
}
|
||||
|
||||
func (repository *accessControlsRepository) FetchAll() (AccessControlEntities, error) {
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `key`, `value` FROM `access_controls` WHERE `id` > 0 AND `status` = 0;"
|
||||
query := `SELECT "id", "key", "value" FROM "access_controls" WHERE "id" > 0 AND "status" = 0;`
|
||||
|
||||
var accessControlEntities AccessControlEntities
|
||||
if err := repository.database.Query(func(cursor ICursor) error {
|
||||
|
@ -138,7 +138,7 @@ func (repository *accessControlsRepository) UpdateKey(id int64, value uint64, ed
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `access_controls` SET `key` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "access_controls" SET "key" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ func (repository *accessControlsRepository) UpdateKeyAtomic(transaction IReposit
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `access_controls` SET `key` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "access_controls" SET "key" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ func (repository *accessControlsRepository) UpdateValue(id int64, value uint64,
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `access_controls` SET `value` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "access_controls" SET "value" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -168,6 +168,6 @@ func (repository *accessControlsRepository) UpdateValueAtomic(transaction IRepos
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `access_controls` SET `value` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "access_controls" SET "value" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ func (repository *activityPubFollowersRepository) Add(entity IActivityPubFollowe
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `activity_pub_followers` (`id`, `handle`, `inbox`, `subject`, `activity`, `accepted`, `editor`) VALUES (?, ?, ?, ?, ?, ?, ?);"
|
||||
query := `INSERT INTO "activity_pub_followers" ("id", "handle", "inbox", "subject", "activity", "accepted", "editor") VALUES ($1, $2, $3, $4, $5, $6, $7);`
|
||||
return repository.database.InsertSingle(query, entity.Id(), entity.Handle(), entity.Inbox(), entity.Subject(), entity.Activity(), entity.Accepted(), editor)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ func (repository *activityPubFollowersRepository) AddAtomic(transaction IReposit
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `activity_pub_followers` (`id`, `handle`, `inbox`, `subject`, `activity`, `accepted`, `editor`) VALUES (?, ?, ?, ?, ?, ?, ?);"
|
||||
query := `INSERT INTO "activity_pub_followers" ("id", "handle", "inbox", "subject", "activity", "accepted", "editor") VALUES ($1, $2, $3, $4, $5, $6, $7);`
|
||||
return repository.database.InsertSingleAtomic(transaction, query, entity.Id(), entity.Handle(), entity.Inbox(), entity.Subject(), entity.Activity(), entity.Accepted(), editor)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ func (repository *activityPubFollowersRepository) FetchById(id int64) (IActivity
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `handle`, `inbox`, `subject`, `activity`, `accepted` = b'1' FROM `activity_pub_followers` WHERE `id` = ? AND `status` = 0;"
|
||||
query := `SELECT "id", "handle", "inbox", "subject", "activity", "accepted" = TRUE FROM "activity_pub_followers" WHERE "id" = $1 AND "status" = 0;`
|
||||
|
||||
var activityPubFollowerEntity IActivityPubFollowerEntity
|
||||
if err := repository.database.QuerySingle(func(cursor ICursor) error {
|
||||
|
@ -76,7 +76,7 @@ func (repository *activityPubFollowersRepository) Update(entity IActivityPubFoll
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_followers` SET `handle` = ?, `inbox` = ?, `subject` = ?, `activity` = ?, `accepted` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_followers" SET "handle" = $1, "inbox" = $2, "subject" = $3, "activity" = $4, "accepted" = $5, "editor" = $6 WHERE "id" = $7;`
|
||||
return repository.database.UpdateSingle(query, entity.Handle(), entity.Inbox(), entity.Subject(), entity.Activity(), entity.Accepted(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ func (repository *activityPubFollowersRepository) UpdateAtomic(transaction IRepo
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_followers` SET `handle` = ?, `inbox` = ?, `subject` = ?, `activity` = ?, `accepted` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_followers" SET "handle" = $1, "inbox" = $2, "subject" = $3, "activity" = $4, "accepted" = $5, "editor" = $6 WHERE "id" = $7;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, entity.Handle(), entity.Inbox(), entity.Subject(), entity.Activity(), entity.Accepted(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ func (repository *activityPubFollowersRepository) Remove(entity IActivityPubFoll
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_followers` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_followers" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingle(query, editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -106,13 +106,13 @@ func (repository *activityPubFollowersRepository) RemoveAtomic(transaction IRepo
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_followers` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_followers" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingleAtomic(transaction, query, editor, entity.Id())
|
||||
}
|
||||
|
||||
func (repository *activityPubFollowersRepository) FetchAll() (ActivityPubFollowerEntities, error) {
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `handle`, `inbox`, `subject`, `activity`, `accepted` = b'1' FROM `activity_pub_followers` WHERE `id` > 0 AND `status` = 0;"
|
||||
query := `SELECT "id", "handle", "inbox", "subject", "activity", "accepted" = TRUE FROM "activity_pub_followers" WHERE "id" > 0 AND "status" = 0;`
|
||||
|
||||
var activityPubFollowerEntities ActivityPubFollowerEntities
|
||||
if err := repository.database.Query(func(cursor ICursor) error {
|
||||
|
@ -144,7 +144,7 @@ func (repository *activityPubFollowersRepository) UpdateHandle(id int64, value s
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_followers` SET `handle` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_followers" SET "handle" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ func (repository *activityPubFollowersRepository) UpdateHandleAtomic(transaction
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_followers` SET `handle` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_followers" SET "handle" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ func (repository *activityPubFollowersRepository) UpdateInbox(id int64, value st
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_followers` SET `inbox` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_followers" SET "inbox" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ func (repository *activityPubFollowersRepository) UpdateInboxAtomic(transaction
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_followers` SET `inbox` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_followers" SET "inbox" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ func (repository *activityPubFollowersRepository) UpdateSubject(id int64, value
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_followers` SET `subject` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_followers" SET "subject" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ func (repository *activityPubFollowersRepository) UpdateSubjectAtomic(transactio
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_followers` SET `subject` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_followers" SET "subject" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ func (repository *activityPubFollowersRepository) UpdateActivity(id int64, value
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_followers` SET `activity` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_followers" SET "activity" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ func (repository *activityPubFollowersRepository) UpdateActivityAtomic(transacti
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_followers` SET `activity` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_followers" SET "activity" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ func (repository *activityPubFollowersRepository) UpdateAccepted(id int64, value
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_followers` SET `accepted` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_followers" SET "accepted" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -234,6 +234,6 @@ func (repository *activityPubFollowersRepository) UpdateAcceptedAtomic(transacti
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_followers` SET `accepted` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_followers" SET "accepted" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ func (repository *activityPubIncomingActivitiesRepository) Add(entity IActivityP
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `activity_pub_incoming_activities` (`id`, `identity_id`, `unique_identifier`, `timestamp`, `from`, `to`, `content`, `raw`, `editor`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);"
|
||||
query := `INSERT INTO "activity_pub_incoming_activities" ("id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw", "editor") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);`
|
||||
return repository.database.InsertSingle(query, entity.Id(), entity.IdentityId(), entity.UniqueIdentifier(), entity.Timestamp(), entity.From(), entity.To(), entity.Content(), entity.Raw(), editor)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ func (repository *activityPubIncomingActivitiesRepository) AddAtomic(transaction
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `activity_pub_incoming_activities` (`id`, `identity_id`, `unique_identifier`, `timestamp`, `from`, `to`, `content`, `raw`, `editor`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);"
|
||||
query := `INSERT INTO "activity_pub_incoming_activities" ("id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw", "editor") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);`
|
||||
return repository.database.InsertSingleAtomic(transaction, query, entity.Id(), entity.IdentityId(), entity.UniqueIdentifier(), entity.Timestamp(), entity.From(), entity.To(), entity.Content(), entity.Raw(), editor)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ func (repository *activityPubIncomingActivitiesRepository) FetchById(id int64) (
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `identity_id`, `unique_identifier`, `timestamp`, `from`, `to`, `content`, `raw` FROM `activity_pub_incoming_activities` WHERE `id` = ? AND `status` = 0;"
|
||||
query := `SELECT "id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw" FROM "activity_pub_incoming_activities" WHERE "id" = $1 AND "status" = 0;`
|
||||
|
||||
var activityPubIncomingActivityEntity IActivityPubIncomingActivityEntity
|
||||
if err := repository.database.QuerySingle(func(cursor ICursor) error {
|
||||
|
@ -78,7 +78,7 @@ func (repository *activityPubIncomingActivitiesRepository) Update(entity IActivi
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `identity_id` = ?, `unique_identifier` = ?, `timestamp` = ?, `from` = ?, `to` = ?, `content` = ?, `raw` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "identity_id" = $1, "unique_identifier" = $2, "timestamp" = $3, "from" = $4, "to" = $5, "content" = $6, "raw" = $7, "editor" = $8 WHERE "id" = $9;`
|
||||
return repository.database.UpdateSingle(query, entity.IdentityId(), entity.UniqueIdentifier(), entity.Timestamp(), entity.From(), entity.To(), entity.Content(), entity.Raw(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ func (repository *activityPubIncomingActivitiesRepository) UpdateAtomic(transact
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `identity_id` = ?, `unique_identifier` = ?, `timestamp` = ?, `from` = ?, `to` = ?, `content` = ?, `raw` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "identity_id" = $1, "unique_identifier" = $2, "timestamp" = $3, "from" = $4, "to" = $5, "content" = $6, "raw" = $7, "editor" = $8 WHERE "id" = $9;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, entity.IdentityId(), entity.UniqueIdentifier(), entity.Timestamp(), entity.From(), entity.To(), entity.Content(), entity.Raw(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ func (repository *activityPubIncomingActivitiesRepository) Remove(entity IActivi
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingle(query, editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -108,13 +108,13 @@ func (repository *activityPubIncomingActivitiesRepository) RemoveAtomic(transact
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingleAtomic(transaction, query, editor, entity.Id())
|
||||
}
|
||||
|
||||
func (repository *activityPubIncomingActivitiesRepository) FetchAll() (ActivityPubIncomingActivityEntities, error) {
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `identity_id`, `unique_identifier`, `timestamp`, `from`, `to`, `content`, `raw` FROM `activity_pub_incoming_activities` WHERE `id` > 0 AND `status` = 0;"
|
||||
query := `SELECT "id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw" FROM "activity_pub_incoming_activities" WHERE "id" > 0 AND "status" = 0;`
|
||||
|
||||
var activityPubIncomingActivityEntities ActivityPubIncomingActivityEntities
|
||||
if err := repository.database.Query(func(cursor ICursor) error {
|
||||
|
@ -152,8 +152,8 @@ func (repository *activityPubIncomingActivitiesRepository) FetchAllByIdentity(id
|
|||
|
||||
func (repository *activityPubIncomingActivitiesRepository) FetchAllByDependency(dependencyName string, dependencyId int64) (ActivityPubIncomingActivityEntities, error) {
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `identity_id`, `unique_identifier`, `timestamp`, `from`, `to`, `content`, `raw` FROM `activity_pub_incoming_activities` WHERE `id` > 0 AND `status` = 0"
|
||||
query += " AND `" + dependencyName + "` = ?;"
|
||||
query := `SELECT "id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw" FROM "activity_pub_incoming_activities" WHERE "id" > 0 AND "status" = 0`
|
||||
query += ` AND "` + dependencyName + `" = $1;`
|
||||
|
||||
var activityPubIncomingActivityEntities ActivityPubIncomingActivityEntities
|
||||
if err := repository.database.Query(func(cursor ICursor) error {
|
||||
|
@ -187,7 +187,7 @@ func (repository *activityPubIncomingActivitiesRepository) UpdateUniqueIdentifie
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `unique_identifier` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "unique_identifier" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ func (repository *activityPubIncomingActivitiesRepository) UpdateUniqueIdentifie
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `unique_identifier` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "unique_identifier" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ func (repository *activityPubIncomingActivitiesRepository) UpdateTimestamp(id in
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `timestamp` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "timestamp" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ func (repository *activityPubIncomingActivitiesRepository) UpdateTimestampAtomic
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `timestamp` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "timestamp" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ func (repository *activityPubIncomingActivitiesRepository) UpdateFrom(id int64,
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `from` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "from" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ func (repository *activityPubIncomingActivitiesRepository) UpdateFromAtomic(tran
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `from` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "from" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ func (repository *activityPubIncomingActivitiesRepository) UpdateTo(id int64, va
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `to` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "to" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ func (repository *activityPubIncomingActivitiesRepository) UpdateToAtomic(transa
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `to` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "to" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ func (repository *activityPubIncomingActivitiesRepository) UpdateContent(id int6
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `content` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "content" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,7 @@ func (repository *activityPubIncomingActivitiesRepository) UpdateContentAtomic(t
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `content` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "content" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ func (repository *activityPubIncomingActivitiesRepository) UpdateRaw(id int64, v
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `raw` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "raw" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -297,6 +297,6 @@ func (repository *activityPubIncomingActivitiesRepository) UpdateRawAtomic(trans
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_incoming_activities` SET `raw` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_incoming_activities" SET "raw" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ func (repository *activityPubOutgoingActivitiesRepository) Add(entity IActivityP
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `activity_pub_outgoing_activities` (`id`, `identity_id`, `unique_identifier`, `timestamp`, `from`, `to`, `content`, `raw`, `editor`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);"
|
||||
query := `INSERT INTO "activity_pub_outgoing_activities" ("id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw", "editor") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);`
|
||||
return repository.database.InsertSingle(query, entity.Id(), entity.IdentityId(), entity.UniqueIdentifier(), entity.Timestamp(), entity.From(), entity.To(), entity.Content(), entity.Raw(), editor)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ func (repository *activityPubOutgoingActivitiesRepository) AddAtomic(transaction
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `activity_pub_outgoing_activities` (`id`, `identity_id`, `unique_identifier`, `timestamp`, `from`, `to`, `content`, `raw`, `editor`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);"
|
||||
query := `INSERT INTO "activity_pub_outgoing_activities" ("id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw", "editor") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);`
|
||||
return repository.database.InsertSingleAtomic(transaction, query, entity.Id(), entity.IdentityId(), entity.UniqueIdentifier(), entity.Timestamp(), entity.From(), entity.To(), entity.Content(), entity.Raw(), editor)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ func (repository *activityPubOutgoingActivitiesRepository) FetchById(id int64) (
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `identity_id`, `unique_identifier`, `timestamp`, `from`, `to`, `content`, `raw` FROM `activity_pub_outgoing_activities` WHERE `id` = ? AND `status` = 0;"
|
||||
query := `SELECT "id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw" FROM "activity_pub_outgoing_activities" WHERE "id" = $1 AND "status" = 0;`
|
||||
|
||||
var activityPubOutgoingActivityEntity IActivityPubOutgoingActivityEntity
|
||||
if err := repository.database.QuerySingle(func(cursor ICursor) error {
|
||||
|
@ -78,7 +78,7 @@ func (repository *activityPubOutgoingActivitiesRepository) Update(entity IActivi
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `identity_id` = ?, `unique_identifier` = ?, `timestamp` = ?, `from` = ?, `to` = ?, `content` = ?, `raw` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "identity_id" = $1, "unique_identifier" = $2, "timestamp" = $3, "from" = $4, "to" = $5, "content" = $6, "raw" = $7, "editor" = $8 WHERE "id" = $9;`
|
||||
return repository.database.UpdateSingle(query, entity.IdentityId(), entity.UniqueIdentifier(), entity.Timestamp(), entity.From(), entity.To(), entity.Content(), entity.Raw(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ func (repository *activityPubOutgoingActivitiesRepository) UpdateAtomic(transact
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `identity_id` = ?, `unique_identifier` = ?, `timestamp` = ?, `from` = ?, `to` = ?, `content` = ?, `raw` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "identity_id" = $1, "unique_identifier" = $2, "timestamp" = $3, "from" = $4, "to" = $5, "content" = $6, "raw" = $7, "editor" = $8 WHERE "id" = $9;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, entity.IdentityId(), entity.UniqueIdentifier(), entity.Timestamp(), entity.From(), entity.To(), entity.Content(), entity.Raw(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ func (repository *activityPubOutgoingActivitiesRepository) Remove(entity IActivi
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingle(query, editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -108,13 +108,13 @@ func (repository *activityPubOutgoingActivitiesRepository) RemoveAtomic(transact
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingleAtomic(transaction, query, editor, entity.Id())
|
||||
}
|
||||
|
||||
func (repository *activityPubOutgoingActivitiesRepository) FetchAll() (ActivityPubOutgoingActivityEntities, error) {
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `identity_id`, `unique_identifier`, `timestamp`, `from`, `to`, `content`, `raw` FROM `activity_pub_outgoing_activities` WHERE `id` > 0 AND `status` = 0;"
|
||||
query := `SELECT "id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw" FROM "activity_pub_outgoing_activities" WHERE "id" > 0 AND "status" = 0;`
|
||||
|
||||
var activityPubOutgoingActivityEntities ActivityPubOutgoingActivityEntities
|
||||
if err := repository.database.Query(func(cursor ICursor) error {
|
||||
|
@ -152,8 +152,8 @@ func (repository *activityPubOutgoingActivitiesRepository) FetchAllByIdentity(id
|
|||
|
||||
func (repository *activityPubOutgoingActivitiesRepository) FetchAllByDependency(dependencyName string, dependencyId int64) (ActivityPubOutgoingActivityEntities, error) {
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `identity_id`, `unique_identifier`, `timestamp`, `from`, `to`, `content`, `raw` FROM `activity_pub_outgoing_activities` WHERE `id` > 0 AND `status` = 0"
|
||||
query += " AND `" + dependencyName + "` = ?;"
|
||||
query := `SELECT "id", "identity_id", "unique_identifier", "timestamp", "from", "to", "content", "raw" FROM "activity_pub_outgoing_activities" WHERE "id" > 0 AND "status" = 0`
|
||||
query += ` AND "` + dependencyName + `" = $1;`
|
||||
|
||||
var activityPubOutgoingActivityEntities ActivityPubOutgoingActivityEntities
|
||||
if err := repository.database.Query(func(cursor ICursor) error {
|
||||
|
@ -187,7 +187,7 @@ func (repository *activityPubOutgoingActivitiesRepository) UpdateUniqueIdentifie
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `unique_identifier` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "unique_identifier" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ func (repository *activityPubOutgoingActivitiesRepository) UpdateUniqueIdentifie
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `unique_identifier` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "unique_identifier" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ func (repository *activityPubOutgoingActivitiesRepository) UpdateTimestamp(id in
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `timestamp` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "timestamp" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ func (repository *activityPubOutgoingActivitiesRepository) UpdateTimestampAtomic
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `timestamp` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "timestamp" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ func (repository *activityPubOutgoingActivitiesRepository) UpdateFrom(id int64,
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `from` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "from" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ func (repository *activityPubOutgoingActivitiesRepository) UpdateFromAtomic(tran
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `from` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "from" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ func (repository *activityPubOutgoingActivitiesRepository) UpdateTo(id int64, va
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `to` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "to" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ func (repository *activityPubOutgoingActivitiesRepository) UpdateToAtomic(transa
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `to` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "to" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ func (repository *activityPubOutgoingActivitiesRepository) UpdateContent(id int6
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `content` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "content" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,7 @@ func (repository *activityPubOutgoingActivitiesRepository) UpdateContentAtomic(t
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `content` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "content" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ func (repository *activityPubOutgoingActivitiesRepository) UpdateRaw(id int64, v
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `raw` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "raw" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -297,6 +297,6 @@ func (repository *activityPubOutgoingActivitiesRepository) UpdateRawAtomic(trans
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `activity_pub_outgoing_activities` SET `raw` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "activity_pub_outgoing_activities" SET "raw" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ func (repository *baseRepository) Migrate() error {
|
|||
|
||||
if !schema.HasTable(repository.pluralName) {
|
||||
script := createTablesScript + createTriggersScript
|
||||
if err := repository.GetSqlDatabase().RunScript(script); err != nil {
|
||||
if err := repository.GetSqlDatabase().RunScript(script, "##########"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -67,15 +67,15 @@ func (repository *baseRepository) Migrate() error {
|
|||
return fmt.Errorf("DB_MIGRATION: history.%s", repository.pluralName)
|
||||
}
|
||||
|
||||
if !schema.HasTrigger(fmt.Sprintf("%s_after_update", repository.pluralName)) {
|
||||
return fmt.Errorf("DB_MIGRATION: %s_after_update", repository.pluralName)
|
||||
if !schema.HasTrigger(fmt.Sprintf("%s_after_update_trigger", repository.pluralName)) {
|
||||
return fmt.Errorf("DB_MIGRATION: %s_after_update_trigger", repository.pluralName)
|
||||
}
|
||||
|
||||
if !schema.HasTrigger(fmt.Sprintf("%s_after_delete", repository.pluralName)) {
|
||||
return fmt.Errorf("DB_MIGRATION: %s_after_delete", repository.pluralName)
|
||||
if !schema.HasTrigger(fmt.Sprintf("%s_after_delete_trigger", repository.pluralName)) {
|
||||
return fmt.Errorf("DB_MIGRATION: %s_after_delete_trigger", repository.pluralName)
|
||||
}
|
||||
|
||||
_, err := repository.database.Execute("INSERT INTO `__system__` (`script`) VALUES (?);", script)
|
||||
_, err := repository.database.Execute(`INSERT INTO "__system__" ("script") VALUES ($1);`, script)
|
||||
if err != nil {
|
||||
repository.logger.Alert(fmt.Sprintf("DB_MIGRATION: %s", err))
|
||||
}
|
||||
|
@ -92,31 +92,28 @@ func (repository *baseRepository) Migrate() error {
|
|||
column := field.Tag.Get("json")
|
||||
dbType := field.Tag.Get("storage")
|
||||
defaultValue := field.Tag.Get("default")
|
||||
previousColumn := field.Tag.Get("previous")
|
||||
|
||||
if field.Name != "entity" && !schema.HasColumn(repository.pluralName, column) {
|
||||
changes = append(changes, fmt.Sprintf("%s.%s", repository.pluralName, column))
|
||||
commands = append(commands, fmt.Sprintf("ALTER TABLE `%s` ADD COLUMN `%s` %s NOT NULL DEFAULT %s AFTER `%s`;", repository.pluralName, column, dbType, defaultValue, previousColumn))
|
||||
|
||||
if previousColumn == "id" {
|
||||
historyCommands = append(historyCommands, fmt.Sprintf("ALTER TABLE `%s` ADD COLUMN `%s` %s NOT NULL DEFAULT %s AFTER `%s`;", repository.pluralName, column, dbType, defaultValue, "original_id"))
|
||||
} else {
|
||||
historyCommands = append(historyCommands, fmt.Sprintf("ALTER TABLE `%s` ADD COLUMN `%s` %s NOT NULL DEFAULT %s AFTER `%s`;", repository.pluralName, column, dbType, defaultValue, previousColumn))
|
||||
}
|
||||
commands = append(commands, fmt.Sprintf(`ALTER TABLE "%s" ADD COLUMN "%s" %s NOT NULL;`, repository.pluralName, column, dbType))
|
||||
commands = append(commands, fmt.Sprintf(`ALTER TABLE "%s" ALTER COLUMN "%s" SET DEFAULT %s;`, repository.pluralName, column, defaultValue))
|
||||
|
||||
historyCommands = append(historyCommands, fmt.Sprintf(`ALTER TABLE "%s_history" ADD COLUMN "%s" %s NOT NULL;`, repository.pluralName, column, dbType))
|
||||
historyCommands = append(historyCommands, fmt.Sprintf(`ALTER TABLE "%s_history" ALTER COLUMN "%s" SET DEFAULT %s;`, repository.pluralName, column, defaultValue))
|
||||
}
|
||||
}
|
||||
|
||||
scriptLines := make([]string, 0)
|
||||
var scriptLines []string
|
||||
if len(commands) > 0 {
|
||||
scriptLines = append([]string{fmt.Sprintf("USE `%s_history`;\n", repository.GetSqlDatabase().GetName())}, historyCommands...)
|
||||
scriptLines = append(scriptLines, fmt.Sprintf("\nUSE `%s`;\n", repository.GetSqlDatabase().GetName()))
|
||||
scriptLines = append(scriptLines, fmt.Sprintf("DROP TRIGGER `%s_after_update`;", repository.pluralName))
|
||||
scriptLines = append(scriptLines, fmt.Sprintf("DROP TRIGGER `%s_after_delete`;\n", repository.pluralName))
|
||||
scriptLines = append([]string{}, historyCommands...)
|
||||
scriptLines = append(scriptLines, fmt.Sprintf(`DROP TRIGGER "%s_after_update_trigger" ON "%s";`, repository.pluralName, repository.pluralName))
|
||||
scriptLines = append(scriptLines, fmt.Sprintf(`DROP TRIGGER "%s_after_delete_trigger" ON "%s";`, repository.pluralName, repository.pluralName))
|
||||
scriptLines = append(scriptLines, commands...)
|
||||
scriptLines = append(scriptLines, createTriggersScript)
|
||||
script := strings.Join(scriptLines, "\n")
|
||||
script := strings.Join(scriptLines, "\n##########\n")
|
||||
|
||||
if err := repository.GetSqlDatabase().RunScript(script); err != nil {
|
||||
if err := repository.GetSqlDatabase().RunScript(script, "##########"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -131,15 +128,15 @@ func (repository *baseRepository) Migrate() error {
|
|||
}
|
||||
}
|
||||
|
||||
if !schema.HasTrigger(fmt.Sprintf("%s_after_update", repository.pluralName)) {
|
||||
return fmt.Errorf("DB_MIGRATION: %s_after_update", repository.pluralName)
|
||||
if !schema.HasTrigger(fmt.Sprintf("%s_after_update_trigger", repository.pluralName)) {
|
||||
return fmt.Errorf("DB_MIGRATION: %s_after_update_trigger", repository.pluralName)
|
||||
}
|
||||
|
||||
if !schema.HasTrigger(fmt.Sprintf("%s_after_delete", repository.pluralName)) {
|
||||
return fmt.Errorf("DB_MIGRATION: %s_after_delete", repository.pluralName)
|
||||
if !schema.HasTrigger(fmt.Sprintf("%s_after_delete_trigger", repository.pluralName)) {
|
||||
return fmt.Errorf("DB_MIGRATION: %s_after_delete_trigger", repository.pluralName)
|
||||
}
|
||||
|
||||
_, err := repository.database.Execute("INSERT INTO `__system__` (`script`) VALUES (?);", script)
|
||||
_, err := repository.database.Execute(`INSERT INTO "__system__" ("script") VALUES ($1);`, script)
|
||||
if err != nil {
|
||||
repository.logger.Alert(fmt.Sprintf("DB_MIGRATION: %s", err))
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ func (repository *categoriesRepository) Add(entity ICategoryEntity, editor int64
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `categories` (`id`, `category_type_id`, `category_id`, `title`, `description`, `editor`) VALUES (?, ?, ?, ?, ?, ?);"
|
||||
query := `INSERT INTO "categories" ("id", "category_type_id", "category_id", "title", "description", "editor") VALUES ($1, $2, $3, $4, $5, $6);`
|
||||
return repository.database.InsertSingle(query, entity.Id(), entity.CategoryTypeId(), entity.CategoryId(), entity.Title(), entity.Description(), editor)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ func (repository *categoriesRepository) AddAtomic(transaction IRepositoryTransac
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `categories` (`id`, `category_type_id`, `category_id`, `title`, `description`, `editor`) VALUES (?, ?, ?, ?, ?, ?);"
|
||||
query := `INSERT INTO "categories" ("id", "category_type_id", "category_id", "title", "description", "editor") VALUES ($1, $2, $3, $4, $5, $6);`
|
||||
return repository.database.InsertSingleAtomic(transaction, query, entity.Id(), entity.CategoryTypeId(), entity.CategoryId(), entity.Title(), entity.Description(), editor)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ func (repository *categoriesRepository) FetchById(id int64) (ICategoryEntity, er
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `category_type_id`, `category_id`, `title`, `description` FROM `categories` WHERE `id` = ? AND `status` = 0;"
|
||||
query := `SELECT "id", "category_type_id", "category_id", "title", "description" FROM "categories" WHERE "id" = $1 AND "status" = 0;`
|
||||
|
||||
var categoryEntity ICategoryEntity
|
||||
if err := repository.database.QuerySingle(func(cursor ICursor) error {
|
||||
|
@ -75,7 +75,7 @@ func (repository *categoriesRepository) Update(entity ICategoryEntity, editor in
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `categories` SET `category_type_id` = ?, `category_id` = ?, `title` = ?, `description` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "categories" SET "category_type_id" = $1, "category_id" = $2, "title" = $3, "description" = $4, "editor" = $5 WHERE "id" = $6;`
|
||||
return repository.database.UpdateSingle(query, entity.CategoryTypeId(), entity.CategoryId(), entity.Title(), entity.Description(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ func (repository *categoriesRepository) UpdateAtomic(transaction IRepositoryTran
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `categories` SET `category_type_id` = ?, `category_id` = ?, `title` = ?, `description` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "categories" SET "category_type_id" = $1, "category_id" = $2, "title" = $3, "description" = $4, "editor" = $5 WHERE "id" = $6;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, entity.CategoryTypeId(), entity.CategoryId(), entity.Title(), entity.Description(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ func (repository *categoriesRepository) Remove(entity ICategoryEntity, editor in
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `categories` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "categories" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingle(query, editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -105,13 +105,13 @@ func (repository *categoriesRepository) RemoveAtomic(transaction IRepositoryTran
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `categories` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "categories" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingleAtomic(transaction, query, editor, entity.Id())
|
||||
}
|
||||
|
||||
func (repository *categoriesRepository) FetchAll() (CategoryEntities, error) {
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `category_type_id`, `category_id`, `title`, `description` FROM `categories` WHERE `id` > 0 AND `status` = 0;"
|
||||
query := `SELECT "id", "category_type_id", "category_id", "title", "description" FROM "categories" WHERE "id" > 0 AND "status" = 0;`
|
||||
|
||||
var categoryEntities CategoryEntities
|
||||
if err := repository.database.Query(func(cursor ICursor) error {
|
||||
|
@ -154,8 +154,8 @@ func (repository *categoriesRepository) FetchAllByCategory(categoryId int64) (Ca
|
|||
|
||||
func (repository *categoriesRepository) FetchAllByDependency(dependencyName string, dependencyId int64) (CategoryEntities, error) {
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `category_type_id`, `category_id`, `title`, `description` FROM `categories` WHERE `id` > 0 AND `status` = 0"
|
||||
query += " AND `" + dependencyName + "` = ?;"
|
||||
query := `SELECT "id", "category_type_id", "category_id", "title", "description" FROM "categories" WHERE "id" > 0 AND "status" = 0`
|
||||
query += ` AND "` + dependencyName + `" = $1;`
|
||||
|
||||
var categoryEntities CategoryEntities
|
||||
if err := repository.database.Query(func(cursor ICursor) error {
|
||||
|
@ -186,7 +186,7 @@ func (repository *categoriesRepository) UpdateTitle(id int64, value string, edit
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `categories` SET `title` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "categories" SET "title" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ func (repository *categoriesRepository) UpdateTitleAtomic(transaction IRepositor
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `categories` SET `title` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "categories" SET "title" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ func (repository *categoriesRepository) UpdateDescription(id int64, value string
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `categories` SET `description` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "categories" SET "description" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -216,6 +216,6 @@ func (repository *categoriesRepository) UpdateDescriptionAtomic(transaction IRep
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `categories` SET `description` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "categories" SET "description" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ func (repository *categoryTypesRepository) Add(entity ICategoryTypeEntity, edito
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `category_types` (`id`, `description`, `editor`) VALUES (?, ?, ?);"
|
||||
query := `INSERT INTO "category_types" ("id", "description", "editor") VALUES ($1, $2, $3);`
|
||||
return repository.database.InsertSingle(query, entity.Id(), entity.Description(), editor)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ func (repository *categoryTypesRepository) AddAtomic(transaction IRepositoryTran
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `category_types` (`id`, `description`, `editor`) VALUES (?, ?, ?);"
|
||||
query := `INSERT INTO "category_types" ("id", "description", "editor") VALUES ($1, $2, $3);`
|
||||
return repository.database.InsertSingleAtomic(transaction, query, entity.Id(), entity.Description(), editor)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ func (repository *categoryTypesRepository) FetchById(id int64) (ICategoryTypeEnt
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `description` FROM `category_types` WHERE `id` = ? AND `status` = 0;"
|
||||
query := `SELECT "id", "description" FROM "category_types" WHERE "id" = $1 AND "status" = 0;`
|
||||
|
||||
var categoryTypeEntity ICategoryTypeEntity
|
||||
if err := repository.database.QuerySingle(func(cursor ICursor) error {
|
||||
|
@ -72,7 +72,7 @@ func (repository *categoryTypesRepository) Update(entity ICategoryTypeEntity, ed
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `category_types` SET `description` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "category_types" SET "description" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, entity.Description(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ func (repository *categoryTypesRepository) UpdateAtomic(transaction IRepositoryT
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `category_types` SET `description` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "category_types" SET "description" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, entity.Description(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ func (repository *categoryTypesRepository) Remove(entity ICategoryTypeEntity, ed
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `category_types` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "category_types" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingle(query, editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -102,13 +102,13 @@ func (repository *categoryTypesRepository) RemoveAtomic(transaction IRepositoryT
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `category_types` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "category_types" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingleAtomic(transaction, query, editor, entity.Id())
|
||||
}
|
||||
|
||||
func (repository *categoryTypesRepository) FetchAll() (CategoryTypeEntities, error) {
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `description` FROM `category_types` WHERE `id` > 0 AND `status` = 0;"
|
||||
query := `SELECT "id", "description" FROM "category_types" WHERE "id" > 0 AND "status" = 0;`
|
||||
|
||||
var categoryTypeEntities CategoryTypeEntities
|
||||
if err := repository.database.Query(func(cursor ICursor) error {
|
||||
|
@ -136,7 +136,7 @@ func (repository *categoryTypesRepository) UpdateDescription(id int64, value str
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `category_types` SET `description` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "category_types" SET "description" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -146,6 +146,6 @@ func (repository *categoryTypesRepository) UpdateDescriptionAtomic(transaction I
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `category_types` SET `description` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "category_types" SET "description" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ func (repository *documentsRepository) Add(entity IDocumentEntity, editor int64)
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `documents` (`id`, `content`, `editor`) VALUES (?, ?, ?);"
|
||||
query := `INSERT INTO "documents" ("id", "content", "editor") VALUES ($1, $2, $3);`
|
||||
return repository.database.InsertSingle(query, entity.Id(), entity.Content(), editor)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ func (repository *documentsRepository) AddAtomic(transaction IRepositoryTransact
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `documents` (`id`, `content`, `editor`) VALUES (?, ?, ?);"
|
||||
query := `INSERT INTO "documents" ("id", "content", "editor") VALUES ($1, $2, $3);`
|
||||
return repository.database.InsertSingleAtomic(transaction, query, entity.Id(), entity.Content(), editor)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ func (repository *documentsRepository) FetchById(id int64) (IDocumentEntity, err
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `content` FROM `documents` WHERE `id` = ? AND `status` = 0;"
|
||||
query := `SELECT "id", "content" FROM "documents" WHERE "id" = $1 AND "status" = 0;`
|
||||
|
||||
var documentEntity IDocumentEntity
|
||||
if err := repository.database.QuerySingle(func(cursor ICursor) error {
|
||||
|
@ -72,7 +72,7 @@ func (repository *documentsRepository) Update(entity IDocumentEntity, editor int
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `documents` SET `content` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "documents" SET "content" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, entity.Content(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ func (repository *documentsRepository) UpdateAtomic(transaction IRepositoryTrans
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `documents` SET `content` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "documents" SET "content" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, entity.Content(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ func (repository *documentsRepository) Remove(entity IDocumentEntity, editor int
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `documents` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "documents" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingle(query, editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -102,13 +102,13 @@ func (repository *documentsRepository) RemoveAtomic(transaction IRepositoryTrans
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `documents` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "documents" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingleAtomic(transaction, query, editor, entity.Id())
|
||||
}
|
||||
|
||||
func (repository *documentsRepository) FetchAll() (DocumentEntities, error) {
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `content` FROM `documents` WHERE `id` > 0 AND `status` = 0;"
|
||||
query := `SELECT "id", "content" FROM "documents" WHERE "id" > 0 AND "status" = 0;`
|
||||
|
||||
var documentEntities DocumentEntities
|
||||
if err := repository.database.Query(func(cursor ICursor) error {
|
||||
|
@ -136,7 +136,7 @@ func (repository *documentsRepository) UpdateContent(id int64, value string, edi
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `documents` SET `content` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "documents" SET "content" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -146,6 +146,6 @@ func (repository *documentsRepository) UpdateContentAtomic(transaction IReposito
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `documents` SET `content` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "documents" SET "content" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ func (repository *identitiesRepository) Add(entity IIdentityEntity, editor int64
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `identities` (`id`, `username`, `phone_number`, `phone_number_confirmed`, `first_name`, `last_name`, `display_name`, `email`, `email_confirmed`, `avatar`, `banner`, `summary`, `token`, `multi_factor`, `hash`, `salt`, `public_key`, `private_key`, `permission`, `restriction`, `last_login`, `login_count`, `editor`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
|
||||
query := `INSERT INTO "identities" ("id", "username", "phone_number", "phone_number_confirmed", "first_name", "last_name", "display_name", "email", "email_confirmed", "avatar", "banner", "summary", "token", "multi_factor", "hash", "salt", "public_key", "private_key", "permission", "restriction", "last_login", "login_count", "editor") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23);`
|
||||
return repository.database.InsertSingle(query, entity.Id(), entity.Username(), entity.PhoneNumber(), entity.PhoneNumberConfirmed(), entity.FirstName(), entity.LastName(), entity.DisplayName(), entity.Email(), entity.EmailConfirmed(), entity.Avatar(), entity.Banner(), entity.Summary(), entity.Token(), entity.MultiFactor(), entity.Hash(), entity.Salt(), entity.PublicKey(), entity.PrivateKey(), entity.Permission(), entity.Restriction(), entity.LastLogin(), entity.LoginCount(), editor)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ func (repository *identitiesRepository) AddAtomic(transaction IRepositoryTransac
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `identities` (`id`, `username`, `phone_number`, `phone_number_confirmed`, `first_name`, `last_name`, `display_name`, `email`, `email_confirmed`, `avatar`, `banner`, `summary`, `token`, `multi_factor`, `hash`, `salt`, `public_key`, `private_key`, `permission`, `restriction`, `last_login`, `login_count`, `editor`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
|
||||
query := `INSERT INTO "identities" ("id", "username", "phone_number", "phone_number_confirmed", "first_name", "last_name", "display_name", "email", "email_confirmed", "avatar", "banner", "summary", "token", "multi_factor", "hash", "salt", "public_key", "private_key", "permission", "restriction", "last_login", "login_count", "editor") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23);`
|
||||
return repository.database.InsertSingleAtomic(transaction, query, entity.Id(), entity.Username(), entity.PhoneNumber(), entity.PhoneNumberConfirmed(), entity.FirstName(), entity.LastName(), entity.DisplayName(), entity.Email(), entity.EmailConfirmed(), entity.Avatar(), entity.Banner(), entity.Summary(), entity.Token(), entity.MultiFactor(), entity.Hash(), entity.Salt(), entity.PublicKey(), entity.PrivateKey(), entity.Permission(), entity.Restriction(), entity.LastLogin(), entity.LoginCount(), editor)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ func (repository *identitiesRepository) FetchById(id int64) (IIdentityEntity, er
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `username`, `phone_number`, `phone_number_confirmed` = b'1', `first_name`, `last_name`, `display_name`, `email`, `email_confirmed` = b'1', `avatar`, `banner`, `summary`, `token`, `multi_factor` = b'1', `hash`, `salt`, `public_key`, `private_key`, `permission`, `restriction`, `last_login`, `login_count` FROM `identities` WHERE `id` = ? AND `status` = 0;"
|
||||
query := `SELECT "id", "username", "phone_number", "phone_number_confirmed" = TRUE, "first_name", "last_name", "display_name", "email", "email_confirmed" = TRUE, "avatar", "banner", "summary", "token", "multi_factor" = TRUE, "hash", "salt", "public_key", "private_key", "permission", "restriction", "last_login", "login_count" FROM "identities" WHERE "id" = $1 AND "status" = 0;`
|
||||
|
||||
var identityEntity IIdentityEntity
|
||||
if err := repository.database.QuerySingle(func(cursor ICursor) error {
|
||||
|
@ -92,7 +92,7 @@ func (repository *identitiesRepository) Update(entity IIdentityEntity, editor in
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `username` = ?, `phone_number` = ?, `phone_number_confirmed` = ?, `first_name` = ?, `last_name` = ?, `display_name` = ?, `email` = ?, `email_confirmed` = ?, `avatar` = ?, `banner` = ?, `summary` = ?, `token` = ?, `multi_factor` = ?, `hash` = ?, `salt` = ?, `public_key` = ?, `private_key` = ?, `permission` = ?, `restriction` = ?, `last_login` = ?, `login_count` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "username" = $1, "phone_number" = $2, "phone_number_confirmed" = $3, "first_name" = $4, "last_name" = $5, "display_name" = $6, "email" = $7, "email_confirmed" = $8, "avatar" = $9, "banner" = $10, "summary" = $11, "token" = $12, "multi_factor" = $13, "hash" = $14, "salt" = $15, "public_key" = $16, "private_key" = $17, "permission" = $18, "restriction" = $19, "last_login" = $20, "login_count" = $21, "editor" = $22 WHERE "id" = $23;`
|
||||
return repository.database.UpdateSingle(query, entity.Username(), entity.PhoneNumber(), entity.PhoneNumberConfirmed(), entity.FirstName(), entity.LastName(), entity.DisplayName(), entity.Email(), entity.EmailConfirmed(), entity.Avatar(), entity.Banner(), entity.Summary(), entity.Token(), entity.MultiFactor(), entity.Hash(), entity.Salt(), entity.PublicKey(), entity.PrivateKey(), entity.Permission(), entity.Restriction(), entity.LastLogin(), entity.LoginCount(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ func (repository *identitiesRepository) UpdateAtomic(transaction IRepositoryTran
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `username` = ?, `phone_number` = ?, `phone_number_confirmed` = ?, `first_name` = ?, `last_name` = ?, `display_name` = ?, `email` = ?, `email_confirmed` = ?, `avatar` = ?, `banner` = ?, `summary` = ?, `token` = ?, `multi_factor` = ?, `hash` = ?, `salt` = ?, `public_key` = ?, `private_key` = ?, `permission` = ?, `restriction` = ?, `last_login` = ?, `login_count` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "username" = $1, "phone_number" = $2, "phone_number_confirmed" = $3, "first_name" = $4, "last_name" = $5, "display_name" = $6, "email" = $7, "email_confirmed" = $8, "avatar" = $9, "banner" = $10, "summary" = $11, "token" = $12, "multi_factor" = $13, "hash" = $14, "salt" = $15, "public_key" = $16, "private_key" = $17, "permission" = $18, "restriction" = $19, "last_login" = $20, "login_count" = $21, "editor" = $22 WHERE "id" = $23;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, entity.Username(), entity.PhoneNumber(), entity.PhoneNumberConfirmed(), entity.FirstName(), entity.LastName(), entity.DisplayName(), entity.Email(), entity.EmailConfirmed(), entity.Avatar(), entity.Banner(), entity.Summary(), entity.Token(), entity.MultiFactor(), entity.Hash(), entity.Salt(), entity.PublicKey(), entity.PrivateKey(), entity.Permission(), entity.Restriction(), entity.LastLogin(), entity.LoginCount(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ func (repository *identitiesRepository) Remove(entity IIdentityEntity, editor in
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingle(query, editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -122,13 +122,13 @@ func (repository *identitiesRepository) RemoveAtomic(transaction IRepositoryTran
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingleAtomic(transaction, query, editor, entity.Id())
|
||||
}
|
||||
|
||||
func (repository *identitiesRepository) FetchAll() (IdentityEntities, error) {
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `username`, `phone_number`, `phone_number_confirmed` = b'1', `first_name`, `last_name`, `display_name`, `email`, `email_confirmed` = b'1', `avatar`, `banner`, `summary`, `token`, `multi_factor` = b'1', `hash`, `salt`, `public_key`, `private_key`, `permission`, `restriction`, `last_login`, `login_count` FROM `identities` WHERE `id` > 0 AND `status` = 0;"
|
||||
query := `SELECT "id", "username", "phone_number", "phone_number_confirmed" = TRUE, "first_name", "last_name", "display_name", "email", "email_confirmed" = TRUE, "avatar", "banner", "summary", "token", "multi_factor" = TRUE, "hash", "salt", "public_key", "private_key", "permission", "restriction", "last_login", "login_count" FROM "identities" WHERE "id" > 0 AND "status" = 0;`
|
||||
|
||||
var identityEntities IdentityEntities
|
||||
if err := repository.database.Query(func(cursor ICursor) error {
|
||||
|
@ -176,7 +176,7 @@ func (repository *identitiesRepository) UpdateUsername(id int64, value string, e
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `username` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "username" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ func (repository *identitiesRepository) UpdateUsernameAtomic(transaction IReposi
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `username` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "username" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ func (repository *identitiesRepository) UpdatePhoneNumber(id int64, value string
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `phone_number` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "phone_number" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ func (repository *identitiesRepository) UpdatePhoneNumberAtomic(transaction IRep
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `phone_number` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "phone_number" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ func (repository *identitiesRepository) UpdatePhoneNumberConfirmed(id int64, val
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `phone_number_confirmed` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "phone_number_confirmed" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ func (repository *identitiesRepository) UpdatePhoneNumberConfirmedAtomic(transac
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `phone_number_confirmed` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "phone_number_confirmed" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ func (repository *identitiesRepository) UpdateFirstName(id int64, value string,
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `first_name` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "first_name" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ func (repository *identitiesRepository) UpdateFirstNameAtomic(transaction IRepos
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `first_name` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "first_name" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ func (repository *identitiesRepository) UpdateLastName(id int64, value string, e
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `last_name` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "last_name" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ func (repository *identitiesRepository) UpdateLastNameAtomic(transaction IReposi
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `last_name` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "last_name" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ func (repository *identitiesRepository) UpdateDisplayName(id int64, value string
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `display_name` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "display_name" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ func (repository *identitiesRepository) UpdateDisplayNameAtomic(transaction IRep
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `display_name` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "display_name" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ func (repository *identitiesRepository) UpdateEmail(id int64, value string, edit
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `email` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "email" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ func (repository *identitiesRepository) UpdateEmailAtomic(transaction IRepositor
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `email` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "email" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ func (repository *identitiesRepository) UpdateEmailConfirmed(id int64, value boo
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `email_confirmed` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "email_confirmed" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ func (repository *identitiesRepository) UpdateEmailConfirmedAtomic(transaction I
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `email_confirmed` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "email_confirmed" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -336,7 +336,7 @@ func (repository *identitiesRepository) UpdateAvatar(id int64, value string, edi
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `avatar` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "avatar" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ func (repository *identitiesRepository) UpdateAvatarAtomic(transaction IReposito
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `avatar` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "avatar" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -356,7 +356,7 @@ func (repository *identitiesRepository) UpdateBanner(id int64, value string, edi
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `banner` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "banner" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -366,7 +366,7 @@ func (repository *identitiesRepository) UpdateBannerAtomic(transaction IReposito
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `banner` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "banner" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -376,7 +376,7 @@ func (repository *identitiesRepository) UpdateSummary(id int64, value string, ed
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `summary` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "summary" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ func (repository *identitiesRepository) UpdateSummaryAtomic(transaction IReposit
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `summary` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "summary" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,7 @@ func (repository *identitiesRepository) UpdateToken(id int64, value string, edit
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `token` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "token" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ func (repository *identitiesRepository) UpdateTokenAtomic(transaction IRepositor
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `token` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "token" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -416,7 +416,7 @@ func (repository *identitiesRepository) UpdateMultiFactor(id int64, value bool,
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `multi_factor` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "multi_factor" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -426,7 +426,7 @@ func (repository *identitiesRepository) UpdateMultiFactorAtomic(transaction IRep
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `multi_factor` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "multi_factor" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -436,7 +436,7 @@ func (repository *identitiesRepository) UpdateHash(id int64, value string, edito
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `hash` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "hash" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -446,7 +446,7 @@ func (repository *identitiesRepository) UpdateHashAtomic(transaction IRepository
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `hash` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "hash" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -456,7 +456,7 @@ func (repository *identitiesRepository) UpdateSalt(id int64, value string, edito
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `salt` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "salt" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -466,7 +466,7 @@ func (repository *identitiesRepository) UpdateSaltAtomic(transaction IRepository
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `salt` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "salt" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -476,7 +476,7 @@ func (repository *identitiesRepository) UpdatePublicKey(id int64, value string,
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `public_key` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "public_key" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -486,7 +486,7 @@ func (repository *identitiesRepository) UpdatePublicKeyAtomic(transaction IRepos
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `public_key` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "public_key" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -496,7 +496,7 @@ func (repository *identitiesRepository) UpdatePrivateKey(id int64, value string,
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `private_key` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "private_key" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -506,7 +506,7 @@ func (repository *identitiesRepository) UpdatePrivateKeyAtomic(transaction IRepo
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `private_key` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "private_key" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -516,7 +516,7 @@ func (repository *identitiesRepository) UpdatePermission(id int64, value uint64,
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `permission` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "permission" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -526,7 +526,7 @@ func (repository *identitiesRepository) UpdatePermissionAtomic(transaction IRepo
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `permission` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "permission" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -536,7 +536,7 @@ func (repository *identitiesRepository) UpdateRestriction(id int64, value uint32
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `restriction` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "restriction" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -546,7 +546,7 @@ func (repository *identitiesRepository) UpdateRestrictionAtomic(transaction IRep
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `restriction` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "restriction" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -556,7 +556,7 @@ func (repository *identitiesRepository) UpdateLastLogin(id int64, value int64, e
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `last_login` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "last_login" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -566,7 +566,7 @@ func (repository *identitiesRepository) UpdateLastLoginAtomic(transaction IRepos
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `last_login` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "last_login" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -576,7 +576,7 @@ func (repository *identitiesRepository) UpdateLoginCount(id int64, value uint32,
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `login_count` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "login_count" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -586,6 +586,6 @@ func (repository *identitiesRepository) UpdateLoginCountAtomic(transaction IRepo
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `identities` SET `login_count` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "identities" SET "login_count" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
. "github.com/xeronith/diamante/contracts/database"
|
||||
. "github.com/xeronith/diamante/contracts/logging"
|
||||
. "github.com/xeronith/diamante/contracts/settings"
|
||||
. "github.com/xeronith/diamante/database/drivers/mysql"
|
||||
. "github.com/xeronith/diamante/database/drivers/postgres"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -29,7 +29,7 @@ var (
|
|||
var database ISqlDatabase
|
||||
|
||||
func Initialize(configuration IConfiguration, logger ILogger) error {
|
||||
databaseName := configuration.GetMySQLConfiguration().GetDatabase()
|
||||
databaseName := configuration.GetPostgreSQLConfiguration().GetDatabase()
|
||||
if strings.TrimSpace(databaseName) == "" {
|
||||
return errors.New("database_required")
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ func (repository *remoteActivitiesRepository) Add(entity IRemoteActivityEntity,
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `remote_activities` (`id`, `entry_point`, `duration`, `successful`, `error_message`, `remote_address`, `user_agent`, `event_type`, `timestamp`, `editor`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
|
||||
query := `INSERT INTO "remote_activities" ("id", "entry_point", "duration", "successful", "error_message", "remote_address", "user_agent", "event_type", "timestamp", "editor") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10);`
|
||||
return repository.database.InsertSingle(query, entity.Id(), entity.EntryPoint(), entity.Duration(), entity.Successful(), entity.ErrorMessage(), entity.RemoteAddress(), entity.UserAgent(), entity.EventType(), entity.Timestamp(), editor)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ func (repository *remoteActivitiesRepository) AddAtomic(transaction IRepositoryT
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `remote_activities` (`id`, `entry_point`, `duration`, `successful`, `error_message`, `remote_address`, `user_agent`, `event_type`, `timestamp`, `editor`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
|
||||
query := `INSERT INTO "remote_activities" ("id", "entry_point", "duration", "successful", "error_message", "remote_address", "user_agent", "event_type", "timestamp", "editor") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10);`
|
||||
return repository.database.InsertSingleAtomic(transaction, query, entity.Id(), entity.EntryPoint(), entity.Duration(), entity.Successful(), entity.ErrorMessage(), entity.RemoteAddress(), entity.UserAgent(), entity.EventType(), entity.Timestamp(), editor)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ func (repository *remoteActivitiesRepository) FetchById(id int64) (IRemoteActivi
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `entry_point`, `duration`, `successful` = b'1', `error_message`, `remote_address`, `user_agent`, `event_type`, `timestamp` FROM `remote_activities` WHERE `id` = ? AND `status` = 0;"
|
||||
query := `SELECT "id", "entry_point", "duration", "successful" = TRUE, "error_message", "remote_address", "user_agent", "event_type", "timestamp" FROM "remote_activities" WHERE "id" = $1 AND "status" = 0;`
|
||||
|
||||
var remoteActivityEntity IRemoteActivityEntity
|
||||
if err := repository.database.QuerySingle(func(cursor ICursor) error {
|
||||
|
@ -79,7 +79,7 @@ func (repository *remoteActivitiesRepository) Update(entity IRemoteActivityEntit
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `entry_point` = ?, `duration` = ?, `successful` = ?, `error_message` = ?, `remote_address` = ?, `user_agent` = ?, `event_type` = ?, `timestamp` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "entry_point" = $1, "duration" = $2, "successful" = $3, "error_message" = $4, "remote_address" = $5, "user_agent" = $6, "event_type" = $7, "timestamp" = $8, "editor" = $9 WHERE "id" = $10;`
|
||||
return repository.database.UpdateSingle(query, entity.EntryPoint(), entity.Duration(), entity.Successful(), entity.ErrorMessage(), entity.RemoteAddress(), entity.UserAgent(), entity.EventType(), entity.Timestamp(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ func (repository *remoteActivitiesRepository) UpdateAtomic(transaction IReposito
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `entry_point` = ?, `duration` = ?, `successful` = ?, `error_message` = ?, `remote_address` = ?, `user_agent` = ?, `event_type` = ?, `timestamp` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "entry_point" = $1, "duration" = $2, "successful" = $3, "error_message" = $4, "remote_address" = $5, "user_agent" = $6, "event_type" = $7, "timestamp" = $8, "editor" = $9 WHERE "id" = $10;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, entity.EntryPoint(), entity.Duration(), entity.Successful(), entity.ErrorMessage(), entity.RemoteAddress(), entity.UserAgent(), entity.EventType(), entity.Timestamp(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ func (repository *remoteActivitiesRepository) Remove(entity IRemoteActivityEntit
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingle(query, editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -109,13 +109,13 @@ func (repository *remoteActivitiesRepository) RemoveAtomic(transaction IReposito
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingleAtomic(transaction, query, editor, entity.Id())
|
||||
}
|
||||
|
||||
func (repository *remoteActivitiesRepository) FetchAll() (RemoteActivityEntities, error) {
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `entry_point`, `duration`, `successful` = b'1', `error_message`, `remote_address`, `user_agent`, `event_type`, `timestamp` FROM `remote_activities` WHERE `id` > 0 AND `status` = 0;"
|
||||
query := `SELECT "id", "entry_point", "duration", "successful" = TRUE, "error_message", "remote_address", "user_agent", "event_type", "timestamp" FROM "remote_activities" WHERE "id" > 0 AND "status" = 0;`
|
||||
|
||||
var remoteActivityEntities RemoteActivityEntities
|
||||
if err := repository.database.Query(func(cursor ICursor) error {
|
||||
|
@ -150,7 +150,7 @@ func (repository *remoteActivitiesRepository) UpdateEntryPoint(id int64, value s
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `entry_point` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "entry_point" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ func (repository *remoteActivitiesRepository) UpdateEntryPointAtomic(transaction
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `entry_point` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "entry_point" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ func (repository *remoteActivitiesRepository) UpdateDuration(id int64, value int
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `duration` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "duration" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ func (repository *remoteActivitiesRepository) UpdateDurationAtomic(transaction I
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `duration` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "duration" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ func (repository *remoteActivitiesRepository) UpdateSuccessful(id int64, value b
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `successful` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "successful" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ func (repository *remoteActivitiesRepository) UpdateSuccessfulAtomic(transaction
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `successful` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "successful" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ func (repository *remoteActivitiesRepository) UpdateErrorMessage(id int64, value
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `error_message` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "error_message" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ func (repository *remoteActivitiesRepository) UpdateErrorMessageAtomic(transacti
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `error_message` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "error_message" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ func (repository *remoteActivitiesRepository) UpdateRemoteAddress(id int64, valu
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `remote_address` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "remote_address" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ func (repository *remoteActivitiesRepository) UpdateRemoteAddressAtomic(transact
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `remote_address` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "remote_address" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ func (repository *remoteActivitiesRepository) UpdateUserAgent(id int64, value st
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `user_agent` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "user_agent" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ func (repository *remoteActivitiesRepository) UpdateUserAgentAtomic(transaction
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `user_agent` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "user_agent" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ func (repository *remoteActivitiesRepository) UpdateEventType(id int64, value ui
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `event_type` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "event_type" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ func (repository *remoteActivitiesRepository) UpdateEventTypeAtomic(transaction
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `event_type` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "event_type" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ func (repository *remoteActivitiesRepository) UpdateTimestamp(id int64, value in
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `timestamp` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "timestamp" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -300,6 +300,6 @@ func (repository *remoteActivitiesRepository) UpdateTimestampAtomic(transaction
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `remote_activities` SET `timestamp` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "remote_activities" SET "timestamp" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ func (repository *systemSchedulesRepository) Add(entity ISystemScheduleEntity, e
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `system_schedules` (`id`, `enabled`, `config`, `editor`) VALUES (?, ?, ?, ?);"
|
||||
query := `INSERT INTO "system_schedules" ("id", "enabled", "config", "editor") VALUES ($1, $2, $3, $4);`
|
||||
return repository.database.InsertSingle(query, entity.Id(), entity.Enabled(), entity.Config(), editor)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ func (repository *systemSchedulesRepository) AddAtomic(transaction IRepositoryTr
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `system_schedules` (`id`, `enabled`, `config`, `editor`) VALUES (?, ?, ?, ?);"
|
||||
query := `INSERT INTO "system_schedules" ("id", "enabled", "config", "editor") VALUES ($1, $2, $3, $4);`
|
||||
return repository.database.InsertSingleAtomic(transaction, query, entity.Id(), entity.Enabled(), entity.Config(), editor)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ func (repository *systemSchedulesRepository) FetchById(id int64) (ISystemSchedul
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `enabled` = b'1', `config` FROM `system_schedules` WHERE `id` = ? AND `status` = 0;"
|
||||
query := `SELECT "id", "enabled" = TRUE, "config" FROM "system_schedules" WHERE "id" = $1 AND "status" = 0;`
|
||||
|
||||
var systemScheduleEntity ISystemScheduleEntity
|
||||
if err := repository.database.QuerySingle(func(cursor ICursor) error {
|
||||
|
@ -73,7 +73,7 @@ func (repository *systemSchedulesRepository) Update(entity ISystemScheduleEntity
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `system_schedules` SET `enabled` = ?, `config` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "system_schedules" SET "enabled" = $1, "config" = $2, "editor" = $3 WHERE "id" = $4;`
|
||||
return repository.database.UpdateSingle(query, entity.Enabled(), entity.Config(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ func (repository *systemSchedulesRepository) UpdateAtomic(transaction IRepositor
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `system_schedules` SET `enabled` = ?, `config` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "system_schedules" SET "enabled" = $1, "config" = $2, "editor" = $3 WHERE "id" = $4;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, entity.Enabled(), entity.Config(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ func (repository *systemSchedulesRepository) Remove(entity ISystemScheduleEntity
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `system_schedules` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "system_schedules" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingle(query, editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -103,13 +103,13 @@ func (repository *systemSchedulesRepository) RemoveAtomic(transaction IRepositor
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `system_schedules` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "system_schedules" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingleAtomic(transaction, query, editor, entity.Id())
|
||||
}
|
||||
|
||||
func (repository *systemSchedulesRepository) FetchAll() (SystemScheduleEntities, error) {
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `enabled` = b'1', `config` FROM `system_schedules` WHERE `id` > 0 AND `status` = 0;"
|
||||
query := `SELECT "id", "enabled" = TRUE, "config" FROM "system_schedules" WHERE "id" > 0 AND "status" = 0;`
|
||||
|
||||
var systemScheduleEntities SystemScheduleEntities
|
||||
if err := repository.database.Query(func(cursor ICursor) error {
|
||||
|
@ -138,7 +138,7 @@ func (repository *systemSchedulesRepository) UpdateEnabled(id int64, value bool,
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `system_schedules` SET `enabled` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "system_schedules" SET "enabled" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ func (repository *systemSchedulesRepository) UpdateEnabledAtomic(transaction IRe
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `system_schedules` SET `enabled` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "system_schedules" SET "enabled" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ func (repository *systemSchedulesRepository) UpdateConfig(id int64, value string
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `system_schedules` SET `config` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "system_schedules" SET "config" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -168,6 +168,6 @@ func (repository *systemSchedulesRepository) UpdateConfigAtomic(transaction IRep
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `system_schedules` SET `config` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "system_schedules" SET "config" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ func (repository *usersRepository) Add(entity IUserEntity, editor int64) error {
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `users` (`id`, `github`, `editor`) VALUES (?, ?, ?);"
|
||||
query := `INSERT INTO "users" ("id", "github", "editor") VALUES ($1, $2, $3);`
|
||||
return repository.database.InsertSingle(query, entity.Id(), entity.Github(), editor)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ func (repository *usersRepository) AddAtomic(transaction IRepositoryTransaction,
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "INSERT INTO `users` (`id`, `github`, `editor`) VALUES (?, ?, ?);"
|
||||
query := `INSERT INTO "users" ("id", "github", "editor") VALUES ($1, $2, $3);`
|
||||
return repository.database.InsertSingleAtomic(transaction, query, entity.Id(), entity.Github(), editor)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ func (repository *usersRepository) FetchById(id int64) (IUserEntity, error) {
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `github` FROM `users` WHERE `id` = ? AND `status` = 0;"
|
||||
query := `SELECT "id", "github" FROM "users" WHERE "id" = $1 AND "status" = 0;`
|
||||
|
||||
var userEntity IUserEntity
|
||||
if err := repository.database.QuerySingle(func(cursor ICursor) error {
|
||||
|
@ -72,7 +72,7 @@ func (repository *usersRepository) Update(entity IUserEntity, editor int64) erro
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `users` SET `github` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "users" SET "github" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, entity.Github(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ func (repository *usersRepository) UpdateAtomic(transaction IRepositoryTransacti
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `users` SET `github` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "users" SET "github" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, entity.Github(), editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ func (repository *usersRepository) Remove(entity IUserEntity, editor int64) erro
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `users` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "users" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingle(query, editor, entity.Id())
|
||||
}
|
||||
|
||||
|
@ -102,13 +102,13 @@ func (repository *usersRepository) RemoveAtomic(transaction IRepositoryTransacti
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `users` SET `status` = 1, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "users" SET "status" = 1, "editor" = $1 WHERE "id" = $2;`
|
||||
return repository.database.DeleteSingleAtomic(transaction, query, editor, entity.Id())
|
||||
}
|
||||
|
||||
func (repository *usersRepository) FetchAll() (UserEntities, error) {
|
||||
// language=SQL
|
||||
query := "SELECT `id`, `github` FROM `users` WHERE `id` > 0 AND `status` = 0;"
|
||||
query := `SELECT "id", "github" FROM "users" WHERE "id" > 0 AND "status" = 0;`
|
||||
|
||||
var userEntities UserEntities
|
||||
if err := repository.database.Query(func(cursor ICursor) error {
|
||||
|
@ -136,7 +136,7 @@ func (repository *usersRepository) UpdateGithub(id int64, value string, editor i
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `users` SET `github` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "users" SET "github" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingle(query, value, editor, id)
|
||||
}
|
||||
|
||||
|
@ -146,6 +146,6 @@ func (repository *usersRepository) UpdateGithubAtomic(transaction IRepositoryTra
|
|||
}
|
||||
|
||||
// language=SQL
|
||||
query := "UPDATE `users` SET `github` = ?, `editor` = ? WHERE `id` = ?;"
|
||||
query := `UPDATE "users" SET "github" = $1, "editor" = $2 WHERE "id" = $3;`
|
||||
return repository.database.UpdateSingleAtomic(transaction, query, value, editor, id)
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue