Files
holos/internal/ent/runtime.go
Jeff McCune adbffe34d8 use go:generate and commit all results (#192)
Previously `go install` fails to install holos.

```
❯ go install github.com/holos-run/holos/cmd/holos@latest
../../go/pkg/mod/github.com/holos-run/holos@v0.86.0/internal/frontend/frontend.go:25:12: pattern holos/dist/holos/ui/index.html: no matching files found
../../go/pkg/mod/github.com/holos-run/holos@v0.86.0/doc/website/website.go:14:12: pattern all:build: no matching files found
```

This is because we do not commit required files.  This patch fixes the
problem by following Rob Pike's guidance to commit generated files.
This patch also replaces the previous use of Makefile tasks to generate
code with //go:generate directives.

This means the process of keeping the source code clean is straight
forward:

```
git clone
make tools
make generate
make build
```

Refer to https://go.dev/blog/generate

> Also, if the containing package is intended for import by go get, once
> the file is generated (and tested!) it must be checked into the source
> code repository to be available to clients. - Rob Pike
2024-07-02 13:50:11 -07:00

95 lines
5.2 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"time"
"github.com/gofrs/uuid"
"github.com/holos-run/holos/internal/ent/organization"
"github.com/holos-run/holos/internal/ent/platform"
"github.com/holos-run/holos/internal/ent/user"
"github.com/holos-run/holos/internal/schema"
)
// The init function reads all schema descriptors with runtime code
// (default values, validators, hooks and policies) and stitches it
// to their package variables.
func init() {
organizationMixin := schema.Organization{}.Mixin()
organizationMixinFields0 := organizationMixin[0].Fields()
_ = organizationMixinFields0
organizationMixinFields1 := organizationMixin[1].Fields()
_ = organizationMixinFields1
organizationFields := schema.Organization{}.Fields()
_ = organizationFields
// organizationDescCreatedAt is the schema descriptor for created_at field.
organizationDescCreatedAt := organizationMixinFields1[0].Descriptor()
// organization.DefaultCreatedAt holds the default value on creation for the created_at field.
organization.DefaultCreatedAt = organizationDescCreatedAt.Default.(func() time.Time)
// organizationDescUpdatedAt is the schema descriptor for updated_at field.
organizationDescUpdatedAt := organizationMixinFields1[1].Descriptor()
// organization.DefaultUpdatedAt holds the default value on creation for the updated_at field.
organization.DefaultUpdatedAt = organizationDescUpdatedAt.Default.(func() time.Time)
// organization.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
organization.UpdateDefaultUpdatedAt = organizationDescUpdatedAt.UpdateDefault.(func() time.Time)
// organizationDescName is the schema descriptor for name field.
organizationDescName := organizationFields[0].Descriptor()
// organization.NameValidator is a validator for the "name" field. It is called by the builders before save.
organization.NameValidator = organizationDescName.Validators[0].(func(string) error)
// organizationDescID is the schema descriptor for id field.
organizationDescID := organizationMixinFields0[0].Descriptor()
// organization.DefaultID holds the default value on creation for the id field.
organization.DefaultID = organizationDescID.Default.(func() uuid.UUID)
platformMixin := schema.Platform{}.Mixin()
platformMixinFields0 := platformMixin[0].Fields()
_ = platformMixinFields0
platformMixinFields1 := platformMixin[1].Fields()
_ = platformMixinFields1
platformFields := schema.Platform{}.Fields()
_ = platformFields
// platformDescCreatedAt is the schema descriptor for created_at field.
platformDescCreatedAt := platformMixinFields1[0].Descriptor()
// platform.DefaultCreatedAt holds the default value on creation for the created_at field.
platform.DefaultCreatedAt = platformDescCreatedAt.Default.(func() time.Time)
// platformDescUpdatedAt is the schema descriptor for updated_at field.
platformDescUpdatedAt := platformMixinFields1[1].Descriptor()
// platform.DefaultUpdatedAt holds the default value on creation for the updated_at field.
platform.DefaultUpdatedAt = platformDescUpdatedAt.Default.(func() time.Time)
// platform.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
platform.UpdateDefaultUpdatedAt = platformDescUpdatedAt.UpdateDefault.(func() time.Time)
// platformDescName is the schema descriptor for name field.
platformDescName := platformFields[1].Descriptor()
// platform.NameValidator is a validator for the "name" field. It is called by the builders before save.
platform.NameValidator = platformDescName.Validators[0].(func(string) error)
// platformDescID is the schema descriptor for id field.
platformDescID := platformMixinFields0[0].Descriptor()
// platform.DefaultID holds the default value on creation for the id field.
platform.DefaultID = platformDescID.Default.(func() uuid.UUID)
userMixin := schema.User{}.Mixin()
userMixinFields0 := userMixin[0].Fields()
_ = userMixinFields0
userMixinFields1 := userMixin[1].Fields()
_ = userMixinFields1
userFields := schema.User{}.Fields()
_ = userFields
// userDescCreatedAt is the schema descriptor for created_at field.
userDescCreatedAt := userMixinFields1[0].Descriptor()
// user.DefaultCreatedAt holds the default value on creation for the created_at field.
user.DefaultCreatedAt = userDescCreatedAt.Default.(func() time.Time)
// userDescUpdatedAt is the schema descriptor for updated_at field.
userDescUpdatedAt := userMixinFields1[1].Descriptor()
// user.DefaultUpdatedAt holds the default value on creation for the updated_at field.
user.DefaultUpdatedAt = userDescUpdatedAt.Default.(func() time.Time)
// user.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
user.UpdateDefaultUpdatedAt = userDescUpdatedAt.UpdateDefault.(func() time.Time)
// userDescEmail is the schema descriptor for email field.
userDescEmail := userFields[0].Descriptor()
// user.EmailValidator is a validator for the "email" field. It is called by the builders before save.
user.EmailValidator = userDescEmail.Validators[0].(func(string) error)
// userDescID is the schema descriptor for id field.
userDescID := userMixinFields0[0].Descriptor()
// user.DefaultID holds the default value on creation for the id field.
user.DefaultID = userDescID.Default.(func() uuid.UUID)
}