Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Convert ORM to Table #23379

Open
2 tasks
Avey777 opened this issue Jan 5, 2025 · 0 comments
Open
2 tasks

[Feature] Convert ORM to Table #23379

Avey777 opened this issue Jan 5, 2025 · 0 comments

Comments

@Avey777
Copy link

Avey777 commented Jan 5, 2025

Describe the feature

Like the 'ent' in the Go language, defined fields can be converted into tables in the database

Use Case

https://pkg.go.dev/entgo.io/ent#Field

type TimeMixin struct {}

func (TimeMixin) Fields() []ent.Field {
	return []ent.Field{
		field.Time("created_at").
			Immutable().
			Default(time.Now),
		field.Time("updated_at").
			Default(time.Now).
			UpdateDefault(time.Now),
	}
}

type T struct {
	ent.Schema
}

func(T) Mixin() []ent.Mixin {
	return []ent.Mixin{
		TimeMixin{},
	}
}

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

0.4.9

Environment details (OS name and version, etc.)

Jengro@Jengro-PC:~/Documents/Dev/express-delivery-service$ v doctor
V full version: V 0.4.9 3953445
OS: linux, Deepin 23
Processor: 6 cpus, 64bit, little endian, Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz

getwd: /home/Jengro/Documents/Dev/express-delivery-service
vexe: /home/Jengro/.vmr/versions/v_versions/v-0.4.9/v
vexe mtime: 2024-12-23 07:39:21

vroot: OK, value: /home/Jengro/.vmr/versions/v_versions/v-0.4.9
VMODULES: OK, value: /home/Jengro/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.45.2
Git vroot status: Error: fatal: not a git repository (or any of the parent directories): .git
.git/config present: false

CC version: cc (Deepin 12.3.0-17deepin8) 12.3.0
emcc version: N/A
thirdparty/tcc: N/A
Jengro@Jengro-PC:~/Documents/Dev/express-delivery-service$

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Huly®: V_0.6-21810

@Avey777 Avey777 changed the title Convert ORM to Table [feature]Convert ORM to Table Jan 5, 2025
@Avey777 Avey777 changed the title [feature]Convert ORM to Table [Feature] Convert ORM to Table Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant