From c17319d6fd23a0c85668ec55ee2a3cea9995b6fe Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Sat, 23 Nov 2024 22:43:41 +0200 Subject: Fixed typo and generated sqlc code --- internal/data/networks.sql.go | 117 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) (limited to 'internal/data/networks.sql.go') diff --git a/internal/data/networks.sql.go b/internal/data/networks.sql.go index 0752609..4b9e390 100644 --- a/internal/data/networks.sql.go +++ b/internal/data/networks.sql.go @@ -217,3 +217,120 @@ func (q *Queries) GetUsersInNetwork(ctx context.Context, networkID snowflake.ID) } return items, nil } + +const setNetworkIcon = `-- name: SetNetworkIcon :one +UPDATE networks SET + icon = ?, + bg_hex_color = ?, + fg_hex_color = ? +WHERE id = ? +RETURNING id, owner_id, name, icon, bg_hex_color, fg_hex_color, is_public +` + +type SetNetworkIconParams struct { + Icon string + BgHexColor *string + FgHexColor string + ID snowflake.ID +} + +func (q *Queries) SetNetworkIcon(ctx context.Context, arg SetNetworkIconParams) (Network, error) { + row := q.db.QueryRowContext(ctx, setNetworkIcon, + arg.Icon, + arg.BgHexColor, + arg.FgHexColor, + arg.ID, + ) + var i Network + err := row.Scan( + &i.ID, + &i.OwnerID, + &i.Name, + &i.Icon, + &i.BgHexColor, + &i.FgHexColor, + &i.IsPublic, + ) + return i, err +} + +const setNetworkIsPublic = `-- name: SetNetworkIsPublic :one +UPDATE networks SET + is_public = ? +WHERE id = ? +RETURNING id, owner_id, name, icon, bg_hex_color, fg_hex_color, is_public +` + +type SetNetworkIsPublicParams struct { + IsPublic bool + ID snowflake.ID +} + +func (q *Queries) SetNetworkIsPublic(ctx context.Context, arg SetNetworkIsPublicParams) (Network, error) { + row := q.db.QueryRowContext(ctx, setNetworkIsPublic, arg.IsPublic, arg.ID) + var i Network + err := row.Scan( + &i.ID, + &i.OwnerID, + &i.Name, + &i.Icon, + &i.BgHexColor, + &i.FgHexColor, + &i.IsPublic, + ) + return i, err +} + +const setNetworkName = `-- name: SetNetworkName :one +UPDATE networks SET + name = ? +WHERE id = ? +RETURNING id, owner_id, name, icon, bg_hex_color, fg_hex_color, is_public +` + +type SetNetworkNameParams struct { + Name string + ID snowflake.ID +} + +func (q *Queries) SetNetworkName(ctx context.Context, arg SetNetworkNameParams) (Network, error) { + row := q.db.QueryRowContext(ctx, setNetworkName, arg.Name, arg.ID) + var i Network + err := row.Scan( + &i.ID, + &i.OwnerID, + &i.Name, + &i.Icon, + &i.BgHexColor, + &i.FgHexColor, + &i.IsPublic, + ) + return i, err +} + +const transferNetwork = `-- name: TransferNetwork :one +UPDATE networks SET + owner_id = ? +WHERE id = ? +RETURNING id, owner_id, name, icon, bg_hex_color, fg_hex_color, is_public +` + +type TransferNetworkParams struct { + OwnerID snowflake.ID + ID snowflake.ID +} + +func (q *Queries) TransferNetwork(ctx context.Context, arg TransferNetworkParams) (Network, error) { + row := q.db.QueryRowContext(ctx, transferNetwork, arg.OwnerID, arg.ID) + var i Network + err := row.Scan( + &i.ID, + &i.OwnerID, + &i.Name, + &i.Icon, + &i.BgHexColor, + &i.FgHexColor, + &i.IsPublic, + ) + return i, err +} -- cgit v1.3.1