(ctx context.Context, opts *database.InsertProjectOptions)
| 438 | } |
| 439 | |
| 440 | func (c *connection) InsertProject(ctx context.Context, opts *database.InsertProjectOptions) (*database.Project, error) { |
| 441 | if err := database.Validate(opts); err != nil { |
| 442 | return nil, err |
| 443 | } |
| 444 | |
| 445 | res := &projectDTO{} |
| 446 | err := c.getDB(ctx).QueryRowxContext(ctx, ` |
| 447 | INSERT INTO projects ( |
| 448 | org_id, |
| 449 | name, |
| 450 | description, |
| 451 | public, |
| 452 | created_by_user_id, |
| 453 | directory_name, |
| 454 | provisioner, |
| 455 | prod_slots, |
| 456 | subpath, |
| 457 | primary_branch, |
| 458 | archive_asset_id, |
| 459 | git_remote, |
| 460 | github_installation_id, |
| 461 | github_repo_id, |
| 462 | managed_git_repo_id, |
| 463 | prod_ttl_seconds, |
| 464 | prod_version, |
| 465 | dev_slots, |
| 466 | dev_ttl_seconds, |
| 467 | override_disk_gb |
| 468 | ) |
| 469 | VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20) RETURNING *`, |
| 470 | opts.OrganizationID, |
| 471 | opts.Name, |
| 472 | opts.Description, |
| 473 | opts.Public, |
| 474 | opts.CreatedByUserID, |
| 475 | opts.DirectoryName, |
| 476 | opts.Provisioner, |
| 477 | opts.ProdSlots, |
| 478 | opts.Subpath, |
| 479 | opts.PrimaryBranch, |
| 480 | opts.ArchiveAssetID, |
| 481 | opts.GitRemote, |
| 482 | opts.GithubInstallationID, |
| 483 | opts.GithubRepoID, |
| 484 | opts.ManagedGitRepoID, |
| 485 | opts.ProdTTLSeconds, |
| 486 | opts.ProdVersion, |
| 487 | opts.DevSlots, |
| 488 | opts.DevTTLSeconds, |
| 489 | opts.OverrideDiskGB, |
| 490 | ).StructScan(res) |
| 491 | if err != nil { |
| 492 | return nil, parseErr("project", err) |
| 493 | } |
| 494 | return c.projectFromDTO(res) |
| 495 | } |
| 496 | |
| 497 | func (c *connection) DeleteProject(ctx context.Context, id string) error { |
nothing calls this directly
no test coverage detected