Skip to content

Override table name when executing SQL #154

@bitxel

Description

@bitxel

Dear developers,

Thanks for your hard work, this library help me a lot, and I have a question about the table name:
As state in the ReadMe doc, the following struct will map to person table,

//reform:people
type Person struct {
	ID        int32      `reform:"id,pk"`
	Name      string     `reform:"name"`
	Email     *string    `reform:"email"`
	CreatedAt time.Time  `reform:"created_at"`
	UpdatedAt *time.Time `reform:"updated_at"`
}

After diving into code, I didn't find any way to reuse this Person struct to other table with the same structure, please advice if I miss any parts:)

So I'd like to propose a set of new Functions like SaveOnTable(record, table_name), UpdateOnTable(record, table_name) etc, which will execute SQL on the appointed table and make it possible to reuse this struct on many tables or sharding tables, like:

person_00
person_01
... 
person_99

Please help review this feature request.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions