Skip to content
Snippets Groups Projects
Commit 5d332fef authored by Christoph Glaubitz's avatar Christoph Glaubitz
Browse files

Created generate scripts for basic functions and tests

Using Tenant as an example:

The API types like Tenant, now go to
`tenancy_tenants_types.go`. This file ends with two `go:generate`
lines. One creates `tenancy_tenants.go` with the service and the functions
like Get, List, Create... The second one creates basic tests in
`tenant_tenants_basic_test.go`.

As a result, `tenancy_tenants.go` and `tenancy_tenants_basic_test.go`
should not be edited by hand. They will be overriden with the next
`go generate`.

Everything belonging to the type should go into
`tenancy_tenants_types.go` (For example MarshalJSON.)
All further tests, no matter if it targets
the type (Tenant) or service (TenantsService), should go to
`tenancy_tenants_test.go`.

In this commit, both (`tenancy_tenant-groups_types.go` and
`tenancy_tenants_type.go`) use `go:generate` to create functions and
basic tests. But this is not a must, if it makes sense to implement
endpoints by hand, this is totally fine.
parent d7212af9
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment