From 80fad8ac3f71db632a9b0bc9826db94d70f20c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Garcia?= Date: Wed, 16 Sep 2020 18:22:52 -0300 Subject: [PATCH] Add ChangeTable function --- kiss_orm.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kiss_orm.go b/kiss_orm.go index 12e8bf3..5ea9cb2 100644 --- a/kiss_orm.go +++ b/kiss_orm.go @@ -32,6 +32,14 @@ func NewClient(dbDriver string, connectionString string, maxOpenConns int) (Clie }, nil } +// ChangeTable returns a new Client configured to use a new table +func (c Client) ChangeTable(ctx context.Context, tableName string) (*Client, error) { + return &Client{ + db: c.db, + tableName: tableName, + }, nil +} + // Find one instance from the database, the input struct // must be passed by reference and the query should // return only one result.