a8m
Repos
101
Followers
3441
Following
27

An entity framework for Go

12480
710

An overview of Go syntax and features.

7153
916

A database toolkit

2119
91

Fast Go decoder for dynamic JSON

598
12

Console progress bar for Rust

502
47

Environment variables substitution for Go

556
60

Events

push

entc/gen: remove driver specific implementation for Exist (#3136)

Created at 14 hours ago
delete branch
a8m delete branch dexist
Created at 14 hours ago
pull request closed
entc/gen: remove driver specific implementation for Exist
Created at 14 hours ago
create branch
a8m create branch dexist
Created at 15 hours ago
pull request opened
entc/gen: remove driver specific implementation for Exist
Created at 15 hours ago
delete branch
a8m delete branch mv-ronen-blog
Created at 16 hours ago
push

doc/website/blog: rename zero downtime blog (#3135)

Created at 16 hours ago
pull request closed
doc/website/blog: rename zero downtime blog
Created at 16 hours ago

sql/postgres: use shared uuid type (#1322)

Created at 1 day ago
delete branch
a8m delete branch pguuid
Created at 1 day ago
pull request closed
sql/postgres: use shared uuid type
Created at 1 day ago

sql/postgres: use shared uuid type

Created at 1 day ago
pull request opened
sql/postgres: use shared uuid type
Created at 1 day ago
create branch
a8m create branch pguuid
Created at 1 day ago

sql/mysql: support native-UUID data type for MariaDB since version 10.7.0 (#1302)

  • adds support for mariadb native uuid data type, since version 10.7.0+

  • removed unused mariadb check, and removed the xtra unneeded newlines as suggested in the PR CR

Created at 1 day ago
pull request closed
sql/mysql: support native-UUID data type for MariaDB since version 10.7.0

I added support for creating migrations from ent where you want to use the native UUID. This data type is supported since version 10.7.0 in maria db. It offers better performance than the varchar(36) solution and similar performance as the binary(16) solution but a readable uuid that does not need conversion.

Unfortunately, Atlas was reporting that the uuid type was an unsupported type when i tried to define it as a custom schemaType inside ent. This PR should fix that.

Inside ent i created a model like this

type Customer struct {
	ent.Schema
}

func (Customer) Fields() []ent.Field {
	return []ent.Field{
		field.UUID("id", uuid.UUID{}).
			SchemaType(map[string]string{
				dialect.MySQL: "uuid",
			}).
			Default(uuid.New).
			StorageKey("id"),
                          //....
	}
}

and then run the creation of the migration (according to the docs)

ctx := context.Background()
	dir, err := sqltool.NewGolangMigrateDir("ent/migrate/migrations")
	if err != nil {
		log.Fatalf("failed creating atlas migration directory: %v", err)
	}
	opts := []schema.MigrateOption{
		schema.WithDir(dir),                         // provide migration directory
		schema.WithMigrationMode(schema.ModeReplay), // provide migration mode
		schema.WithDialect(dialect.MySQL),           // Ent dialect to use
	}
	if len(os.Args) != 2 {
		log.Fatalln("migration name is required. Use: 'go run -mod=mod ent/migrate/main.go <name>'")
	}
	err = migrate.NamedDiff(ctx, "mysql://test:test@localhost:3306/test", os.Args[1], opts...)
	if err != nil {
		log.Fatalf("failed generating migration file: %v", err)
	}

I probably still need to add some tests for the changes but I would love to hear your opinions first on this change.

Created at 1 day ago
closed issue
How to join table with custom join condition by ent api?

I have two tables in mysql: ① socs: +----+--------+-------+--------+ | id | soc_id | sr_id | tac_id | +----+--------+-------+--------+ | 1 | Soc-1 | SR-1 | TAC-1 | | 2 | Soc-2 | SR-2 | NULL | +----+--------+-------+--------+ ② flows: +----+---------+-------+ | id | jira_id | data | +----+---------+-------+ | 1 | SR-1 | data1 | | 2 | TAC-1 | data2 | | 3 | SR-2 | data3 | +----+---------+-------+ I want to execute the sql:

SELECT * FROM socs 
INNER JOIN flows 
    ON socs.sr_id = flows.jira_id OR socs.tac_id = flows.jira_id

but I don't know how to do it by ent api

Created at 1 day ago
issue comment
How to join table with custom join condition by ent api?

Hey @codeReaper2001 👋🏻 I just answered this question on Discord 😉. Please, let’s continue the discussion there: https://discord.com/channels/885059418646003782/885059419107360779/1047547072829734912

Created at 1 day ago
pull request opened
doc/project: add runtimevar examples and doc
Created at 1 day ago

doc/project: add runtimevar examples and doc

Created at 1 day ago

doc/project: add runtimevar examples and doc

Created at 1 day ago
create branch
a8m create branch vardoc
Created at 1 day ago
delete branch
a8m delete branch envschemas
Created at 1 day ago