You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

deprecated.go 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package testfixtures
  2. import (
  3. "database/sql"
  4. )
  5. type (
  6. DataBaseHelper Helper // Deprecated: Use Helper instead
  7. PostgreSQLHelper struct { // Deprecated: Use PostgreSQL{} instead
  8. PostgreSQL
  9. UseAlterConstraint bool
  10. }
  11. MySQLHelper struct { // Deprecated: Use MySQL{} instead
  12. MySQL
  13. }
  14. SQLiteHelper struct { // Deprecated: Use SQLite{} instead
  15. SQLite
  16. }
  17. SQLServerHelper struct { // Deprecated: Use SQLServer{} instead
  18. SQLServer
  19. }
  20. OracleHelper struct { // Deprecated: Use Oracle{} instead
  21. Oracle
  22. }
  23. )
  24. func (h *PostgreSQLHelper) disableReferentialIntegrity(db *sql.DB, loadFn loadFunction) error {
  25. h.PostgreSQL.UseAlterConstraint = h.UseAlterConstraint
  26. return h.PostgreSQL.disableReferentialIntegrity(db, loadFn)
  27. }
  28. // LoadFixtureFiles load all specified fixtures files into database:
  29. // LoadFixtureFiles(db, &PostgreSQL{},
  30. // "fixtures/customers.yml", "fixtures/orders.yml")
  31. // // add as many files you want
  32. //
  33. // Deprecated: Use NewFiles() and Load() instead.
  34. func LoadFixtureFiles(db *sql.DB, helper Helper, files ...string) error {
  35. c, err := NewFiles(db, helper, files...)
  36. if err != nil {
  37. return err
  38. }
  39. return c.Load()
  40. }
  41. // LoadFixtures loads all fixtures in a given folder into the database:
  42. // LoadFixtures("myfixturesfolder", db, &PostgreSQL{})
  43. //
  44. // Deprecated: Use NewFolder() and Load() instead.
  45. func LoadFixtures(folderName string, db *sql.DB, helper Helper) error {
  46. c, err := NewFolder(db, helper, folderName)
  47. if err != nil {
  48. return err
  49. }
  50. return c.Load()
  51. }