api.spaceplanner.app

Spaceplanner API
git clone git://jacobedwards.org/api.spaceplanner.app
Log | Files | Refs

commit 7784691dbae237cb0e44b42c69c18659cb6eee0e
parent 07e9a85c84e32c7e0a8e7869396a7a529bbd6bbd
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Wed,  7 Aug 2024 18:02:12 -0700

Fix duplicate sql statement cache name

I must have copied the create_floorplan statement and forgot to
change the name I used.

This issue provokes thought on changing the interface, but I'm not
sure exactly how I would want to yet. (One option, though a little
more expensive, is using the statement itself as the hash for the
cached statements. Another is making a separate interface for caching
statements and getting cached statements, but that wouldn't have
fixed this problem.)

Diffstat:
Minternal/backend/floorplan.go | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/internal/backend/floorplan.go b/internal/backend/floorplan.go @@ -37,7 +37,7 @@ func (e *Env) CreateFloorplan(tx *sql.Tx, template *Floorplan) (*Floorplan, erro } func (e *Env) UpdateFloorplan(tx *sql.Tx, user string, name string, updated *Floorplan) (*Floorplan, error) { - stmt, err := e.CacheTxStmt(tx, "create_floorplan", `UPDATE spaceplanner.floorplans SET (name, address, synopsis) = + stmt, err := e.CacheTxStmt(tx, "update_floorplan", `UPDATE spaceplanner.floorplans SET (name, address, synopsis) = ($3, $4, $5) WHERE owner = $1 AND name = $2 RETURNING *`) if err != nil { return nil, err