Use use plugin
(plugin Plugin)
| 532 | |
| 533 | // Use use plugin |
| 534 | func (db *DB) Use(plugin Plugin) error { |
| 535 | name := plugin.Name() |
| 536 | if _, ok := db.Plugins[name]; ok { |
| 537 | return ErrRegistered |
| 538 | } |
| 539 | if err := plugin.Initialize(db); err != nil { |
| 540 | return err |
| 541 | } |
| 542 | db.Plugins[name] = plugin |
| 543 | return nil |
| 544 | } |
| 545 | |
| 546 | // ToSQL for generate SQL string. |
| 547 | // |
nothing calls this directly
no test coverage detected