-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.go
More file actions
27 lines (23 loc) · 681 Bytes
/
Copy pathoptions.go
File metadata and controls
27 lines (23 loc) · 681 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package pgxadapter
// Option defines the functional option for configuring the adapter.
type Option func(*Adapter)
// WithTableName sets the table name for the adapter.
func WithTableName(tableName string) Option {
return func(a *Adapter) {
a.tableName = tableName
}
}
// WithDatabase sets the database name for the adapter (if needed).
// Currently, pgx connection string handling usually covers this,
// but if we need specific logic, we can add it here.
// func WithDatabase(dbName string) Option {
// return func(a *Adapter) {
// // ...
// }
// }
// helper to apply options
func (a *Adapter) applyOptions(opts ...Option) {
for _, opt := range opts {
opt(a)
}
}