MCPcopy
hub / github.com/rilldata/rill / InsertUsergroup

Method InsertUsergroup

admin/database/postgres/postgres.go:1055–1068  ·  view source on GitHub ↗
(ctx context.Context, opts *database.InsertUsergroupOptions)

Source from the content-addressed store, hash-verified

1053}
1054
1055func (c *connection) InsertUsergroup(ctx context.Context, opts *database.InsertUsergroupOptions) (*database.Usergroup, error) {
1056 if err := database.Validate(opts); err != nil {
1057 return nil, err
1058 }
1059
1060 res := &database.Usergroup{}
1061 err := c.getDB(ctx).QueryRowxContext(ctx, `
1062 INSERT INTO usergroups (org_id, name, managed) VALUES ($1, $2, $3) RETURNING *
1063 `, opts.OrgID, opts.Name, opts.Managed).StructScan(res)
1064 if err != nil {
1065 return nil, parseErr("usergroup", err)
1066 }
1067 return res, nil
1068}
1069
1070func (c *connection) UpdateUsergroupName(ctx context.Context, name, groupID string) (*database.Usergroup, error) {
1071 res := &database.Usergroup{}

Callers

nothing calls this directly

Calls 3

getDBMethod · 0.95
ValidateFunction · 0.92
parseErrFunction · 0.85

Tested by

no test coverage detected