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

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