MCPcopy Index your code
hub / github.com/rilldata/rill / UpdateService

Method UpdateService

admin/database/postgres/postgres.go:1440–1460  ·  view source on GitHub ↗

UpdateService updates a service.

(ctx context.Context, id string, opts *database.UpdateServiceOptions)

Source from the content-addressed store, hash-verified

1438
1439// UpdateService updates a service.
1440func (c *connection) UpdateService(ctx context.Context, id string, opts *database.UpdateServiceOptions) (*database.Service, error) {
1441 if err := database.Validate(opts); err != nil {
1442 return nil, err
1443 }
1444
1445 if opts.Attributes == nil {
1446 opts.Attributes = make(map[string]any)
1447 }
1448
1449 res := &serviceDTO{}
1450 err := c.getDB(ctx).QueryRowxContext(ctx, `
1451 UPDATE service
1452 SET name=$1, attributes=$2
1453 WHERE id=$3 RETURNING *`,
1454 opts.Name, opts.Attributes, id,
1455 ).StructScan(res)
1456 if err != nil {
1457 return nil, parseErr("service", err)
1458 }
1459 return res.serviceFromDTO()
1460}
1461
1462// UpdateServiceActiceOn updates a service's active_on timestamp.
1463func (c *connection) UpdateServiceActiveOn(ctx context.Context, ids []string) error {

Callers

nothing calls this directly

Calls 4

getDBMethod · 0.95
serviceFromDTOMethod · 0.95
ValidateFunction · 0.92
parseErrFunction · 0.85

Tested by

no test coverage detected