// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.26.0 // source: locations.sql package db import ( "context" "github.com/jackc/pgx/v5/pgtype" ) const getListLocations = `-- name: GetListLocations :many SELECT id, address, name, google_maps_link, location_type, submitted_by, total_visited, thumbnail, regency_id, is_deleted, created_at, updated_at, approved_by, approved_at FROM locations ` func (q *Queries) GetListLocations(ctx context.Context) ([]Location, error) { rows, err := q.db.Query(ctx, getListLocations) if err != nil { return nil, err } defer rows.Close() items := []Location{} for rows.Next() { var i Location if err := rows.Scan( &i.ID, &i.Address, &i.Name, &i.GoogleMapsLink, &i.LocationType, &i.SubmittedBy, &i.TotalVisited, &i.Thumbnail, &i.RegencyID, &i.IsDeleted, &i.CreatedAt, &i.UpdatedAt, &i.ApprovedBy, &i.ApprovedAt, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Err(); err != nil { return nil, err } return items, nil } const getLocationTag = `-- name: GetLocationTag :many SELECT name FROM tags WHERE tags_type = 'location' AND target_id = $1 AND approved_by IS NOT NULL ` func (q *Queries) GetLocationTag(ctx context.Context, targetID int32) ([]string, error) { rows, err := q.db.Query(ctx, getLocationTag, targetID) if err != nil { return nil, err } defer rows.Close() items := []string{} for rows.Next() { var name string if err := rows.Scan(&name); err != nil { return nil, err } items = append(items, name) } if err := rows.Err(); err != nil { return nil, err } return items, nil } const updateLocationThumbnail = `-- name: UpdateLocationThumbnail :exec UPDATE locations SET thumbnail = $1 WHERE id = $2 ` type UpdateLocationThumbnailParams struct { Thumbnail pgtype.Text `json:"thumbnail"` ID int32 `json:"id"` } func (q *Queries) UpdateLocationThumbnail(ctx context.Context, arg UpdateLocationThumbnailParams) error { _, err := q.db.Exec(ctx, updateLocationThumbnail, arg.Thumbnail, arg.ID) return err }