fix: support utf8mb4 across MySQL and MariaDB
Test / test (push) Canceled after 6m35s
Build and publish image / image (push) Successful in 13m42s

This commit is contained in:
bryanpedini committed 2026-11-20 15:14:28 +01:00
1 parent cce17c5fa4
commit d34894c9cd
28 files changed
+224 -121

No files matched your search

+3 -3
View File
@@ -87,12 +87,12 @@ func (s userStore) queryUser(ctx context.Context, query string, args ...any) (us
func (s userStore) UserByUsername(ctx context.Context, username string) (userRow, error) {
defer traceStore(ctx, "userStore.UserByUsername")()
return s.queryUser(ctx, "SELECT "+userColumns+" FROM {users} u WHERE u.`username` = ?", username)
return s.queryUser(ctx, "SELECT "+userColumns+" FROM {users} u WHERE u.`username` = CAST(? AS BINARY)", username)
}
func (s userStore) UserByUsernameForUpdate(ctx context.Context, username string) (userRow, error) {
defer traceStore(ctx, "userStore.UserByUsernameForUpdate")()
return s.queryUser(ctx, "SELECT "+userColumns+" FROM {users} u WHERE u.`username` = ? FOR UPDATE", username)
return s.queryUser(ctx, "SELECT "+userColumns+" FROM {users} u WHERE u.`username` = CAST(? AS BINARY) FOR UPDATE", username)
}
func (s userStore) UserByID(ctx context.Context, id int64) (userRow, error) {
@@ -102,7 +102,7 @@ func (s userStore) UserByID(ctx context.Context, id int64) (userRow, error) {
func (s userStore) UserByIDForShare(ctx context.Context, id int64) (userRow, error) {
defer traceStore(ctx, "userStore.UserByIDForShare")()
return s.queryUser(ctx, "SELECT "+userColumns+" FROM {users} u WHERE u.`id` = ? FOR SHARE", id)
return s.queryUser(ctx, "SELECT "+userColumns+" FROM {users} u WHERE u.`id` = ? LOCK IN SHARE MODE", id)
}
func (s userStore) UserByIDForUpdate(ctx context.Context, id int64) (userRow, error) {