fix
This commit is contained in:
@@ -3,6 +3,7 @@ package database
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/jackc/pgx/v5/pgtype"
|
"github.com/jackc/pgx/v5/pgtype"
|
||||||
|
|
||||||
@@ -22,10 +23,13 @@ WHERE id = $1;`
|
|||||||
|
|
||||||
txOrPool := transaction.TryExtractTX(ctx)
|
txOrPool := transaction.TryExtractTX(ctx)
|
||||||
|
|
||||||
|
username := strings.TrimSpace(channel.Username)
|
||||||
|
usernameValid := username != ""
|
||||||
|
|
||||||
dto := updateChannelDTO{
|
dto := updateChannelDTO{
|
||||||
ID: pgtype.UUID{Bytes: channel.ID, Valid: true},
|
ID: pgtype.UUID{Bytes: channel.ID, Valid: true},
|
||||||
TelegramID: pgtype.Int8{Int64: channel.TelegramID, Valid: true},
|
TelegramID: pgtype.Int8{Int64: channel.TelegramID, Valid: true},
|
||||||
Username: pgtype.Text{String: channel.Username, Valid: true},
|
Username: pgtype.Text{String: username, Valid: usernameValid},
|
||||||
Title: pgtype.Text{String: channel.Title, Valid: true},
|
Title: pgtype.Text{String: channel.Title, Valid: true},
|
||||||
AccessHash: pgtype.Int8{Int64: channel.AccessHash, Valid: true},
|
AccessHash: pgtype.Int8{Int64: channel.AccessHash, Valid: true},
|
||||||
Pts: pgtype.Int4{Int32: int32(channel.Pts), Valid: true},
|
Pts: pgtype.Int4{Int32: int32(channel.Pts), Valid: true},
|
||||||
|
|||||||
Reference in New Issue
Block a user