Add ChangeTable function

pull/2/head
Vinícius Garcia 2020-09-16 18:22:52 -03:00
parent a5ee2458ec
commit 80fad8ac3f
1 changed files with 8 additions and 0 deletions

View File

@ -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.