From 45de713faee7082abcd351e430065e0d5d1764c0 Mon Sep 17 00:00:00 2001 From: Bowen Date: Thu, 14 Mar 2024 21:18:06 +0800 Subject: [PATCH] feat: [#280] Refactor Migration feature --- .github/workflows/mockery.yml | 4 +- .mockery.yaml | 2 +- contracts/database/schema/blueprint.go | 98 + contracts/database/schema/column.go | 33 + contracts/database/schema/grammar.go | 105 + contracts/database/schema/processor.go | 6 + contracts/database/schema/schema.go | 71 + contracts/foundation/container.go | 7 +- database/gorm/query_test.go | 4 +- database/gorm/test_utils.go | 2 +- database/orm.go | 3 +- database/processors/postgres.go | 24 + database/schema/blueprint.go | 325 +++ database/schema/blueprint_test.go | 130 + database/schema/column.go | 52 + database/schema/grammars/mysql.go | 251 ++ database/schema/grammars/postgres.go | 301 +++ database/schema/grammars/postgres_test.go | 172 ++ database/schema/grammars/sqlite.go | 251 ++ database/schema/grammars/sqlserver.go | 251 ++ database/schema/main_test.go | 31 + database/schema/schema.go | 222 ++ database/schema/schema_test.go | 259 ++ database/{ => seeder}/factory.go | 2 +- database/{ => seeder}/factory_test.go | 9 +- database/seeder/main_test.go | 31 + database/{ => seeder}/seeder.go | 19 +- database/{ => seeder}/seeder_test.go | 6 +- database/service_provider.go | 8 +- facades/schema.go | 9 + foundation/container.go | 34 +- mocks/auth/Auth.go | 2 +- mocks/auth/access/Gate.go | 2 +- mocks/auth/access/Response.go | 2 +- mocks/cache/Cache.go | 2 +- mocks/cache/Driver.go | 2 +- mocks/cache/Lock.go | 2 +- mocks/config/Config.go | 2 +- mocks/console/Artisan.go | 2 +- mocks/console/Command.go | 2 +- mocks/console/Context.go | 2 +- mocks/console/command/Flag.go | 2 +- mocks/crypt/Crypt.go | 2 +- mocks/database/factory/Factory.go | 2 +- mocks/database/factory/Model.go | 2 +- mocks/database/gorm/Gorm.go | 2 +- mocks/database/gorm/Initialize.go | 2 +- mocks/database/orm/Association.go | 2 +- mocks/database/orm/ConnectionModel.go | 2 +- mocks/database/orm/Cursor.go | 2 +- mocks/database/orm/DispatchesEvents.go | 2 +- mocks/database/orm/Event.go | 2 +- mocks/database/orm/Factory.go | 2 +- mocks/database/orm/Observer.go | 2 +- mocks/database/orm/Orm.go | 2 +- mocks/database/orm/Query.go | 2 +- mocks/database/orm/Transaction.go | 2 +- mocks/database/schema/Blueprint.go | 2223 ++++++++++++++++ mocks/database/schema/Column.go | 426 +++ mocks/database/schema/Grammar.go | 2273 +++++++++++++++++ mocks/database/schema/Migration.go | 167 ++ mocks/database/schema/Schema.go | 1036 ++++++++ mocks/database/seeder/Facade.go | 2 +- mocks/database/seeder/Seeder.go | 2 +- mocks/event/Event.go | 2 +- mocks/event/Instance.go | 2 +- mocks/event/Listener.go | 2 +- mocks/event/Task.go | 2 +- mocks/filesystem/Driver.go | 2 +- mocks/filesystem/File.go | 2 +- mocks/filesystem/Storage.go | 2 +- mocks/foundation/Application.go | 51 +- mocks/foundation/Container.go | 51 +- mocks/foundation/ServiceProvider.go | 2 +- mocks/grpc/Grpc.go | 2 +- mocks/hash/Hash.go | 2 +- mocks/http/Context.go | 2 +- mocks/http/ContextRequest.go | 2 +- mocks/http/ContextResponse.go | 2 +- mocks/http/FormRequest.go | 2 +- mocks/http/HandlerFunc.go | 2 +- mocks/http/Limit.go | 2 +- mocks/http/Middleware.go | 2 +- mocks/http/RateLimiter.go | 2 +- mocks/http/ResourceController.go | 2 +- mocks/http/Response.go | 2 +- mocks/http/ResponseOrigin.go | 2 +- mocks/http/ResponseStatus.go | 2 +- mocks/http/ResponseSuccess.go | 2 +- mocks/http/ResponseView.go | 2 +- mocks/http/View.go | 2 +- mocks/log/Entry.go | 2 +- mocks/log/Hook.go | 2 +- mocks/log/Log.go | 2 +- mocks/log/Logger.go | 2 +- mocks/log/Writer.go | 2 +- mocks/mail/Mail.go | 2 +- mocks/queue/Job.go | 2 +- mocks/queue/Queue.go | 2 +- mocks/queue/Task.go | 2 +- mocks/queue/Worker.go | 2 +- mocks/route/GroupFunc.go | 2 +- mocks/route/Route.go | 2 +- mocks/route/Router.go | 2 +- mocks/schedule/Event.go | 2 +- mocks/schedule/Schedule.go | 2 +- mocks/session/Driver.go | 2 +- mocks/session/Manager.go | 2 +- mocks/testing/Database.go | 2 +- mocks/testing/DatabaseDriver.go | 2 +- mocks/testing/Docker.go | 2 +- mocks/testing/Testing.go | 2 +- mocks/translation/Loader.go | 2 +- mocks/translation/Translator.go | 2 +- mocks/validation/Data.go | 2 +- mocks/validation/Errors.go | 2 +- mocks/validation/Option.go | 2 +- mocks/validation/Rule.go | 2 +- mocks/validation/Validation.go | 2 +- mocks/validation/Validator.go | 2 +- support/convert/pointer.go | 5 + support/docker/database.go | 98 +- support/docker/database_test.go | 4 +- support/docker/{postgresql.go => postgres.go} | 28 +- .../{postgresql_test.go => postgres_test.go} | 4 +- testing/docker/database.go | 2 +- testing/docker/database_test.go | 2 +- 127 files changed, 9068 insertions(+), 188 deletions(-) create mode 100644 contracts/database/schema/blueprint.go create mode 100644 contracts/database/schema/column.go create mode 100644 contracts/database/schema/grammar.go create mode 100644 contracts/database/schema/processor.go create mode 100644 contracts/database/schema/schema.go create mode 100644 database/processors/postgres.go create mode 100644 database/schema/blueprint.go create mode 100644 database/schema/blueprint_test.go create mode 100644 database/schema/column.go create mode 100644 database/schema/grammars/mysql.go create mode 100644 database/schema/grammars/postgres.go create mode 100644 database/schema/grammars/postgres_test.go create mode 100644 database/schema/grammars/sqlite.go create mode 100644 database/schema/grammars/sqlserver.go create mode 100644 database/schema/main_test.go create mode 100644 database/schema/schema.go create mode 100644 database/schema/schema_test.go rename database/{ => seeder}/factory.go (99%) rename database/{ => seeder}/factory_test.go (98%) create mode 100644 database/seeder/main_test.go rename database/{ => seeder}/seeder.go (77%) rename database/{ => seeder}/seeder_test.go (96%) create mode 100644 facades/schema.go create mode 100644 mocks/database/schema/Blueprint.go create mode 100644 mocks/database/schema/Column.go create mode 100644 mocks/database/schema/Grammar.go create mode 100644 mocks/database/schema/Migration.go create mode 100644 mocks/database/schema/Schema.go create mode 100644 support/convert/pointer.go rename support/docker/{postgresql.go => postgres.go} (77%) rename support/docker/{postgresql_test.go => postgres_test.go} (95%) diff --git a/.github/workflows/mockery.yml b/.github/workflows/mockery.yml index 7259d4b3a..a49d2d1ec 100644 --- a/.github/workflows/mockery.yml +++ b/.github/workflows/mockery.yml @@ -9,10 +9,10 @@ jobs: uses: actions/checkout@v4 - name: Install Mockery run: | - docker pull vektra/mockery:v2.42.1 + go install github.com/vektra/mockery/v2@v2.39.1 - name: Generate Mocks run: | - docker run -v "$PWD":/src -w /src vektra/mockery:v2.42.1 + ~/go/bin/mockery --all --keeptree --dir=contracts - uses: stefanzweifel/git-auto-commit-action@v5 name: Commit changes with: diff --git a/.mockery.yaml b/.mockery.yaml index 8a7472a38..f23ef4540 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -1,4 +1,4 @@ with-expecter: True dir: "contracts" keeptree: True -all: True \ No newline at end of file +all: True diff --git a/contracts/database/schema/blueprint.go b/contracts/database/schema/blueprint.go new file mode 100644 index 000000000..fa1eb82f8 --- /dev/null +++ b/contracts/database/schema/blueprint.go @@ -0,0 +1,98 @@ +package schema + +import ( + ormcontract "github.com/goravel/framework/contracts/database/orm" +) + +type Blueprint interface { + // Boolean Create a new boolean column on the table. + Boolean(column string) ColumnDefinition + // BigInteger Create a new big integer (8-byte) column on the table. + BigInteger(column string) ColumnDefinition + // Binary Create a new binary column on the table. + Binary(column string) ColumnDefinition + // Build Execute the blueprint to build / modify the table. + Build(query ormcontract.Query, grammar Grammar) error + // Char Create a new char column on the table. + Char(column string, length ...int) ColumnDefinition + // Comment Add a comment to the table. + Comment(comment string) error + // Create Indicate that the table needs to be created. + Create() + // Date Create a new date column on the table. + Date(column string) ColumnDefinition + // DateTime Create a new date-time column on the table. + DateTime(column string) ColumnDefinition + // DateTimeTz Create a new date-time column (with time zone) on the table. + DateTimeTz(column string) ColumnDefinition + // Decimal Create a new decimal column on the table. + Decimal(column string) ColumnDefinition + // Double Create a new double column on the table. + Double(column string) ColumnDefinition + // DropColumn Indicate that the given columns should be dropped. + DropColumn(column string) error + // DropForeign Indicate that the given foreign key should be dropped. + DropForeign(index string) error + // DropIndex Indicate that the given index should be dropped. + DropIndex(index string) error + // DropSoftDeletes Indicate that the soft delete column should be dropped. + DropSoftDeletes() error + // DropTimestamps Indicate that the timestamp columns should be dropped. + DropTimestamps() error + // Enum Create a new enum column on the table. + Enum(column string, array []any) ColumnDefinition + // Float Create a new float column on the table. + Float(column string) ColumnDefinition + // Foreign Specify a foreign key for the table. + Foreign(columns []string, name ...string) error + // GetAddedColumns Get the added columns. + GetAddedColumns() []ColumnDefinition + // GetChangedColumns Get the changed columns. + GetChangedColumns() []ColumnDefinition + // GetTableName Get the table name with prefix. + GetTableName() string + // ID Create a new auto-incrementing big integer (8-byte) column on the table. + ID() ColumnDefinition + // Index Specify an index for the table. + Index(columns []string, name string) error + // Integer Create a new integer (4-byte) column on the table. + Integer(column string) ColumnDefinition + // Json Create a new json column on the table. + Json(column string) ColumnDefinition + // Jsonb Create a new jsonb column on the table. + Jsonb(column string) ColumnDefinition + // Primary Specify the primary key(s) for the table. + Primary(columns []string, name string) error + // RenameColumn Indicate that the given columns should be renamed. + RenameColumn(from, to string) error + // RenameIndex Indicate that the given indexes should be renamed. + RenameIndex(from, to string) error + // SoftDeletes Add a "deleted at" timestamp for the table. + SoftDeletes(column ...string) ColumnDefinition + // SoftDeletesTz Add a "deleted at" timestampTz for the table. + SoftDeletesTz(column ...string) ColumnDefinition + // String Create a new string column on the table. + String(column string, length ...int) ColumnDefinition + // Text Create a new text column on the table. + Text(column string) ColumnDefinition + // Time Create a new time column on the table. + Time(column string) ColumnDefinition + // TimeTz Create a new time column (with time zone) on the table. + TimeTz(column string) ColumnDefinition + // Timestamp Create a new time column on the table. + Timestamp(column string) ColumnDefinition + // Timestamps Add nullable creation and update timestamps to the table. + Timestamps() ColumnDefinition + // TimestampsTz Add creation and update timestampTz columns to the table. + TimestampsTz() ColumnDefinition + // TimestampTz Create a new time column (with time zone) on the table. + TimestampTz(column string) ColumnDefinition + // ToSql Get the raw SQL statements for the blueprint. + ToSql(query ormcontract.Query, grammar Grammar) []string + // Unique Specify a unique index for the table. + Unique(columns []string, name string) error + // UnsignedInteger Create a new unsigned integer (4-byte) column on the table. + UnsignedInteger(column string) ColumnDefinition + // UnsignedBigInteger Create a new unsigned big integer (8-byte) column on the table. + UnsignedBigInteger(column string) ColumnDefinition +} diff --git a/contracts/database/schema/column.go b/contracts/database/schema/column.go new file mode 100644 index 000000000..6dffaf1e3 --- /dev/null +++ b/contracts/database/schema/column.go @@ -0,0 +1,33 @@ +package schema + +type Column struct { + AutoIncrement bool + Collation string + Comment string + Default any + Name string + Nullable bool + TypeName string + Type string +} + +type ColumnDefinition interface { + // Change the column + Change() + // GetAllowed returns the allowed value + GetAllowed() []string + // GetAutoIncrement returns the autoIncrement value + GetAutoIncrement() bool + // GetLength returns the length value + GetLength() int + // GetName returns the name value + GetName() string + // GetPlaces returns the places value + GetPlaces() int + // GetPrecision returns the precision value + GetPrecision() int + // GetTotal returns the total value + GetTotal() int + // GetType returns the type value + GetType() string +} diff --git a/contracts/database/schema/grammar.go b/contracts/database/schema/grammar.go new file mode 100644 index 000000000..5cc41bb0e --- /dev/null +++ b/contracts/database/schema/grammar.go @@ -0,0 +1,105 @@ +package schema + +import ( + ormcontract "github.com/goravel/framework/contracts/database/orm" +) + +type Grammar interface { + // CompileAdd Compile an add column command. + CompileAdd(blueprint Blueprint, command string) string + // CompileAutoIncrementStartingValues Compile the auto-incrementing column starting values. + CompileAutoIncrementStartingValues(blueprint Blueprint, command string) string + // CompileChange Compile a change column command into a series of SQL statements. + CompileChange(blueprint Blueprint, command, connection string) string + // CompileColumns Compile the query to determine the columns. + // TODO check if the database is required + CompileColumns(database, table, schema string) string + // CompileCreate Compile a create table command. + CompileCreate(blueprint Blueprint, query ormcontract.Query) string + // CompileCreateEncoding Append the character set specifications to a command. + CompileCreateEncoding(sql, connection string, blueprint Blueprint) string + // CompileCreateEngine Append the engine specifications to a command. + CompileCreateEngine(sql, connection string, blueprint Blueprint) string + // CompileCreateTable Create the main create table clause. + CompileCreateTable(blueprint Blueprint, command, connection string) string + // CompileDrop Compile a drop table command. + CompileDrop(blueprint Blueprint, command string) string + // CompileDropAllTables Compile the SQL needed to drop all tables. + CompileDropAllTables(tables []string) string + // CompileDropAllViews Compile the SQL needed to drop all views. + CompileDropAllViews(views []string) string + // CompileDropColumn Compile a drop column command. + CompileDropColumn(blueprint Blueprint, command string) string + // CompileDropIfExists Compile a drop table (if exists) command. + CompileDropIfExists(blueprint Blueprint, command string) string + // CompileDropIndex Compile a drop index command. + CompileDropIndex(blueprint Blueprint, command string) string + // CompileDropPrimary Compile a drop primary key command. + CompileDropPrimary(blueprint Blueprint, command string) string + // CompileDropUnique Compile a drop unique key command. + CompileDropUnique(blueprint Blueprint, command string) string + // CompilePrimary Compile a primary key command. + CompilePrimary(blueprint Blueprint, command string) string + // CompileIndex Compile a plain index key command. + CompileIndex(blueprint Blueprint, command string) string + // CompileIndexes Compile the query to determine the indexes. + CompileIndexes(database, table string) string + // CompileRename Compile a rename table command. + CompileRename(blueprint Blueprint, command string) string + // CompileRenameColumn Compile a rename column command. + CompileRenameColumn(blueprint Blueprint, command, connection string) string + // CompileRenameIndex Compile a rename index command. + CompileRenameIndex(blueprint Blueprint, command string) string + // CompileTableComment Compile a table comment command. + CompileTableComment(blueprint Blueprint, command string) string + // CompileTables Compile the query to determine the tables. + CompileTables(database string) string + // CompileUnique Compile a unique key command. + CompileUnique(blueprint Blueprint, command string) string + // CompileViews Compile the query to determine the views. + CompileViews(database string) string + // ModifyNullable Get the SQL for a nullable column modifier. + ModifyNullable(blueprint Blueprint, column string) string + // ModifyDefault Get the SQL for a default column modifier. + ModifyDefault(blueprint Blueprint, column string) string + // TypeBigInteger Create the column definition for a big integer type. + TypeBigInteger(column ColumnDefinition) string + // TypeBinary Create the column definition for a binary type. + TypeBinary(column ColumnDefinition) string + // TypeBoolean Create the column definition for a boolean type. + TypeBoolean(column ColumnDefinition) string + // TypeChar Create the column definition for a char type. + TypeChar(column ColumnDefinition) string + // TypeDate Create the column definition for a date type. + TypeDate(column ColumnDefinition) string + // TypeDateTime Create the column definition for a date-time type. + TypeDateTime(column ColumnDefinition) string + // TypeDateTimeTz Create the column definition for a date-time (with time zone) type. + TypeDateTimeTz(column ColumnDefinition) string + // TypeDecimal Create the column definition for a decimal type. + TypeDecimal(column ColumnDefinition) string + // TypeDouble Create the column definition for a double type. + TypeDouble(column ColumnDefinition) string + // TypeEnum Create the column definition for an enumeration type. + TypeEnum(column ColumnDefinition) string + // TypeFloat Create the column definition for a float type. + TypeFloat(column ColumnDefinition) string + // TypeInteger Create the column definition for an integer type. + TypeInteger(column ColumnDefinition) string + // TypeJson Create the column definition for a json type. + TypeJson(column ColumnDefinition) string + // TypeJsonb Create the column definition for a jsonb type. + TypeJsonb(column ColumnDefinition) string + // TypeString Create the column definition for a string type. + TypeString(column ColumnDefinition) string + // TypeText Create the column definition for a text type. + TypeText(column ColumnDefinition) string + // TypeTime Create the column definition for a time type. + TypeTime(column ColumnDefinition) string + // TypeTimeTz Create the column definition for a time (with time zone) type. + TypeTimeTz(column ColumnDefinition) string + // TypeTimestamp Create the column definition for a timestamp type. + TypeTimestamp(column ColumnDefinition) string + // TypeTimestampTz Create the column definition for a timestamp (with time zone) type. + TypeTimestampTz(column ColumnDefinition) string +} diff --git a/contracts/database/schema/processor.go b/contracts/database/schema/processor.go new file mode 100644 index 000000000..05d683011 --- /dev/null +++ b/contracts/database/schema/processor.go @@ -0,0 +1,6 @@ +package schema + +type Processor interface { + // ProcessColumns Process the results of a columns query. + ProcessColumns(columns []Column) []Column +} diff --git a/contracts/database/schema/schema.go b/contracts/database/schema/schema.go new file mode 100644 index 000000000..407cc107f --- /dev/null +++ b/contracts/database/schema/schema.go @@ -0,0 +1,71 @@ +package schema + +type Schema interface { + Connection(name string) Schema + // Create a new table on the schema. + Create(table string, callback func(table Blueprint)) error + // Drop a table from the schema. + Drop(table string) error + // DropAllTables Drop all tables from the database. + DropAllTables() error + // DropAllViews Drop all views from the database. + DropAllViews() error + // DropColumns Drop columns from a table schema. + DropColumns(table string, columns []string) error + // DropIfExists Drop a table from the schema if it exists. + DropIfExists(table string) error + // GetColumns Get the columns for a given table. + GetColumns(table string) ([]Column, error) + // GetColumnListing Get the column listing for a given table. + GetColumnListing(table string) []string + // GetIndexes Get the indexes for a given table. + GetIndexes(table string) []Index + // GetIndexListing Get the names of the indexes for a given table. + GetIndexListing(table string) []string + // GetTableListing Get the names of the tables that belong to the database. + GetTableListing() []string + // GetTables Get the tables that belong to the database. + GetTables() ([]Table, error) + // GetViews Get the views that belong to the database. + GetViews() []View + // HasColumn Determine if the given table has a given column. + HasColumn(table, column string) bool + // HasColumns Determine if the given table has given columns. + HasColumns(table string, columns []string) bool + // HasIndex Determine if the given table has a given index. + HasIndex(table, index string) + // HasTable Determine if the given table exists. + HasTable(table string) bool + // HasView Determine if the given view exists. + HasView(view string) bool + // Register migrations. + Register([]Migration) + // Rename a table on the schema. + Rename(from, to string) + // Table Modify a table on the schema. + Table(table string, callback func(table Blueprint)) error +} + +type Migration interface { + Signature() string + Up() error + Down() error +} + +type Index struct { + Columns []string + Name string + Primary bool + Type string + Unique bool +} + +type Table struct { + Name string + Size int +} + +type View struct { + Definition string + Name string +} diff --git a/contracts/foundation/container.go b/contracts/foundation/container.go index cfacbd63e..d53a72ce0 100644 --- a/contracts/foundation/container.go +++ b/contracts/foundation/container.go @@ -10,6 +10,7 @@ import ( "github.com/goravel/framework/contracts/console" "github.com/goravel/framework/contracts/crypt" "github.com/goravel/framework/contracts/database/orm" + "github.com/goravel/framework/contracts/database/schema" "github.com/goravel/framework/contracts/database/seeder" "github.com/goravel/framework/contracts/event" "github.com/goravel/framework/contracts/filesystem" @@ -70,6 +71,10 @@ type Container interface { MakeRoute() route.Route // MakeSchedule resolves the schedule instance. MakeSchedule() schedule.Schedule + // MakeSchema resolves the schema instance. + MakeSchema() schema.Schema + // MakeSeeder resolves the seeder instance. + MakeSeeder() seeder.Facade // MakeSession resolves the session instance. MakeSession() session.Manager // MakeStorage resolves the storage instance. @@ -80,8 +85,6 @@ type Container interface { MakeValidation() validation.Validation // MakeView resolves the view instance. MakeView() http.View - // MakeSeeder resolves the seeder instance. - MakeSeeder() seeder.Facade // MakeWith resolves the given type with the given parameters from the container. MakeWith(key any, parameters map[string]any) (any, error) // Singleton registers a shared binding in the container. diff --git a/database/gorm/query_test.go b/database/gorm/query_test.go index 65cc87ab2..6126f72fa 100644 --- a/database/gorm/query_test.go +++ b/database/gorm/query_test.go @@ -2277,7 +2277,7 @@ func (s *QueryTestSuite) TestRefreshConnection() { return product }(), setup: func() { - mockPostgresqlConnection(s.mysqlDocker.MockConfig, testDatabaseDocker.Postgresql.Config()) + mockPostgresqlConnection(s.mysqlDocker.MockConfig, testDatabaseDocker.Postgres.Config()) }, expectConnection: "postgresql", }, @@ -3057,7 +3057,7 @@ func TestCustomConnection(t *testing.T) { assert.Nil(t, query.Where("body", "create_review").First(&review1)) assert.True(t, review1.ID > 0) - mockPostgresqlConnection(mysqlDocker.MockConfig, testDatabaseDocker.Postgresql.Config()) + mockPostgresqlConnection(mysqlDocker.MockConfig, testDatabaseDocker.Postgres.Config()) product := Product{Name: "create_product"} assert.Nil(t, query.Create(&product)) diff --git a/database/gorm/test_utils.go b/database/gorm/test_utils.go index a04c99d76..702469e79 100644 --- a/database/gorm/test_utils.go +++ b/database/gorm/test_utils.go @@ -147,7 +147,7 @@ type PostgresqlDocker struct { } func NewPostgresqlDocker(database *supportdocker.Database) *PostgresqlDocker { - config := database.Postgresql.Config() + config := database.Postgres.Config() return &PostgresqlDocker{MockConfig: &mocksconfig.Config{}, Port: config.Port, user: config.Username, password: config.Password, database: config.Database} } diff --git a/database/orm.go b/database/orm.go index 3a23e06c6..7181e43fc 100644 --- a/database/orm.go +++ b/database/orm.go @@ -12,6 +12,7 @@ import ( ormcontract "github.com/goravel/framework/contracts/database/orm" databasegorm "github.com/goravel/framework/database/gorm" "github.com/goravel/framework/database/orm" + "github.com/goravel/framework/database/seeder" ) type OrmImpl struct { @@ -77,7 +78,7 @@ func (r *OrmImpl) Query() ormcontract.Query { } func (r *OrmImpl) Factory() ormcontract.Factory { - return NewFactoryImpl(r.Query()) + return seeder.NewFactoryImpl(r.Query()) } func (r *OrmImpl) Observe(model any, observer ormcontract.Observer) { diff --git a/database/processors/postgres.go b/database/processors/postgres.go new file mode 100644 index 000000000..497e45553 --- /dev/null +++ b/database/processors/postgres.go @@ -0,0 +1,24 @@ +package processors + +import ( + "strings" + + "github.com/spf13/cast" + + schemacontract "github.com/goravel/framework/contracts/database/schema" +) + +type Postgres struct { +} + +func NewPostgres() *Postgres { + return &Postgres{} +} + +func (r *Postgres) ProcessColumns(columns []schemacontract.Column) []schemacontract.Column { + for _, column := range columns { + column.AutoIncrement = column.Default != nil && strings.HasPrefix(cast.ToString(column.Default), "nextval(") + } + + return columns +} diff --git a/database/schema/blueprint.go b/database/schema/blueprint.go new file mode 100644 index 000000000..04d6befe9 --- /dev/null +++ b/database/schema/blueprint.go @@ -0,0 +1,325 @@ +package schema + +import ( + ormcontract "github.com/goravel/framework/contracts/database/orm" + schemacontract "github.com/goravel/framework/contracts/database/schema" + "github.com/goravel/framework/support/convert" +) + +const defaultStringLength = 255 + +type Blueprint struct { + columns []*ColumnDefinition + commands []*Command + prefix string + table string +} + +func NewBlueprint(prefix, table string) *Blueprint { + return &Blueprint{ + prefix: prefix, + table: table, + } +} + +func (r *Blueprint) Boolean(column string) schemacontract.ColumnDefinition { + columnImpl := &ColumnDefinition{ + name: &column, + ttype: convert.Pointer("boolean"), + } + r.addColumn(columnImpl) + + return columnImpl +} + +func (r *Blueprint) BigInteger(column string) schemacontract.ColumnDefinition { + columnImpl := &ColumnDefinition{ + name: &column, + ttype: convert.Pointer("bigInteger"), + } + r.addColumn(columnImpl) + + return columnImpl +} + +func (r *Blueprint) Binary(column string) schemacontract.ColumnDefinition { + columnImpl := &ColumnDefinition{ + name: &column, + ttype: convert.Pointer("binary"), + } + r.addColumn(columnImpl) + + return columnImpl +} + +func (r *Blueprint) Build(query ormcontract.Query, grammar schemacontract.Grammar) error { + for _, sql := range r.ToSql(query, grammar) { + if _, err := query.Exec(sql); err != nil { + return err + } + } + + return nil +} + +func (r *Blueprint) Char(column string, length ...int) schemacontract.ColumnDefinition { + defaultLength := defaultStringLength + if len(length) > 0 { + defaultLength = length[0] + } + + columnImpl := &ColumnDefinition{ + length: &defaultLength, + name: &column, + ttype: convert.Pointer("char"), + } + r.addColumn(columnImpl) + + return columnImpl +} + +func (r *Blueprint) Comment(comment string) error { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) Create() { + r.addCommand("create") +} + +func (r *Blueprint) Date(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) DateTime(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) DateTimeTz(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) Decimal(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) Double(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) DropColumn(column string) error { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) DropForeign(index string) error { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) DropIndex(index string) error { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) DropSoftDeletes() error { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) DropTimestamps() error { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) Enum(column string, array []any) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) Float(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) Foreign(columns []string, name ...string) error { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) GetAddedColumns() []schemacontract.ColumnDefinition { + var columns []schemacontract.ColumnDefinition + for _, column := range r.columns { + if column.change == nil || !*column.change { + columns = append(columns, column) + } + } + + return columns +} + +func (r *Blueprint) GetChangedColumns() []schemacontract.ColumnDefinition { + var columns []schemacontract.ColumnDefinition + for _, column := range r.columns { + if column.change != nil && *column.change { + columns = append(columns, column) + } + } + + return columns +} + +func (r *Blueprint) GetTableName() string { + return r.prefix + r.table +} + +func (r *Blueprint) ID() schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) Index(columns []string, name string) error { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) Integer(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) Json(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) Jsonb(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) Primary(columns []string, name string) error { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) RenameColumn(from, to string) error { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) RenameIndex(from, to string) error { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) SoftDeletes(column ...string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) SoftDeletesTz(column ...string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) String(column string, length ...int) schemacontract.ColumnDefinition { + defaultLength := defaultStringLength + if len(length) > 0 { + defaultLength = length[0] + } + + columnImpl := &ColumnDefinition{ + length: &defaultLength, + name: &column, + ttype: convert.Pointer("string"), + } + r.addColumn(columnImpl) + + return columnImpl +} + +func (r *Blueprint) Text(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) Time(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) TimeTz(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) Timestamp(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) Timestamps() schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) TimestampsTz() schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) TimestampTz(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) ToSql(query ormcontract.Query, grammar schemacontract.Grammar) []string { + var statements []string + for _, command := range r.commands { + switch command.Name { + case "create": + statements = append(statements, grammar.CompileCreate(r, query)) + } + } + + return statements +} + +func (r *Blueprint) Unique(columns []string, name string) error { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) UnsignedInteger(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) UnsignedBigInteger(column string) schemacontract.ColumnDefinition { + //TODO implement me + panic("implement me") +} + +func (r *Blueprint) addColumn(column *ColumnDefinition) { + r.columns = append(r.columns, column) +} + +func (r *Blueprint) addCommand(name string) { + r.commands = append(r.commands, r.createCommand(name)) +} + +func (r *Blueprint) createCommand(name string) *Command { + return &Command{ + Name: name, + } +} + +type Command struct { + Name string +} diff --git a/database/schema/blueprint_test.go b/database/schema/blueprint_test.go new file mode 100644 index 000000000..c3f01d05e --- /dev/null +++ b/database/schema/blueprint_test.go @@ -0,0 +1,130 @@ +package schema + +import ( + "errors" + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/goravel/framework/contracts/database/schema" + "github.com/goravel/framework/database/schema/grammars" + ormmock "github.com/goravel/framework/mocks/database/orm" +) + +type BlueprintTestSuite struct { + suite.Suite + blueprint *Blueprint + grammars []schema.Grammar +} + +func TestBlueprintTestSuite(t *testing.T) { + suite.Run(t, &BlueprintTestSuite{ + grammars: []schema.Grammar{ + grammars.NewPostgres(), + }, + }) +} + +func (s *BlueprintTestSuite) SetupTest() { + s.blueprint = NewBlueprint("goravel_", "users") +} + +func (s *BlueprintTestSuite) TestBuild() { + for _, grammar := range s.grammars { + mockQuery := &ormmock.Query{} + + s.blueprint.Create() + s.blueprint.String("name") + + mockQuery.On("Exec", s.blueprint.ToSql(mockQuery, grammar)[0]).Return(nil, nil).Once() + s.Nil(s.blueprint.Build(mockQuery, grammar)) + + mockQuery.On("Exec", s.blueprint.ToSql(mockQuery, grammar)[0]).Return(nil, errors.New("error")).Once() + s.EqualError(s.blueprint.Build(mockQuery, grammar), "error") + + mockQuery.AssertExpectations(s.T()) + } +} + +func (s *BlueprintTestSuite) TestChar() { + column := "name" + customLength := 100 + length := defaultStringLength + ttype := "char" + s.blueprint.Char(column) + s.Contains(s.blueprint.GetAddedColumns(), &ColumnDefinition{ + length: &length, + name: &column, + ttype: &ttype, + }) + + s.blueprint.Char(column, customLength) + s.Contains(s.blueprint.GetAddedColumns(), &ColumnDefinition{ + length: &customLength, + name: &column, + ttype: &ttype, + }) +} + +func (s *BlueprintTestSuite) TestGetAddedColumns() { + name := "name" + change := true + addedColumn := &ColumnDefinition{ + name: &name, + } + changedColumn := &ColumnDefinition{ + change: &change, + name: &name, + } + + s.blueprint.columns = []*ColumnDefinition{addedColumn, changedColumn} + + s.Len(s.blueprint.GetAddedColumns(), 1) + s.Equal(addedColumn, s.blueprint.GetAddedColumns()[0]) +} + +func (s *BlueprintTestSuite) TestGetChangedColumns() { + name := "name" + change := true + addedColumn := &ColumnDefinition{ + name: &name, + } + changedColumn := &ColumnDefinition{ + change: &change, + name: &name, + } + + s.blueprint.columns = []*ColumnDefinition{addedColumn, changedColumn} + + s.Len(s.blueprint.GetChangedColumns(), 1) + s.Equal(changedColumn, s.blueprint.GetChangedColumns()[0]) +} + +func (s *BlueprintTestSuite) TestString() { + column := "name" + customLength := 100 + length := defaultStringLength + ttype := "string" + s.blueprint.String(column) + s.Contains(s.blueprint.GetAddedColumns(), &ColumnDefinition{ + length: &length, + name: &column, + ttype: &ttype, + }) + + s.blueprint.String(column, customLength) + s.Contains(s.blueprint.GetAddedColumns(), &ColumnDefinition{ + length: &customLength, + name: &column, + ttype: &ttype, + }) +} + +func (s *BlueprintTestSuite) TestToSql() { + for _, grammar := range s.grammars { + mockQuery := &ormmock.Query{} + s.blueprint.Create() + s.blueprint.String("name") + s.NotEmpty(s.blueprint.ToSql(mockQuery, grammar)) + } +} diff --git a/database/schema/column.go b/database/schema/column.go new file mode 100644 index 000000000..bfc1138cc --- /dev/null +++ b/database/schema/column.go @@ -0,0 +1,52 @@ +package schema + +type ColumnDefinition struct { + allowed []string + autoIncrement *bool + change *bool + comment *string + def *string + length *int + name *string + nullable *bool + places *int + precision *int + total *int + ttype *string +} + +func (r *ColumnDefinition) Change() { + *r.change = true +} + +func (r *ColumnDefinition) GetAllowed() []string { + return r.allowed +} + +func (r *ColumnDefinition) GetAutoIncrement() bool { + return *r.autoIncrement +} + +func (r *ColumnDefinition) GetLength() int { + return *r.length +} + +func (r *ColumnDefinition) GetName() string { + return *r.name +} + +func (r *ColumnDefinition) GetPlaces() int { + return *r.places +} + +func (r *ColumnDefinition) GetPrecision() int { + return *r.precision +} + +func (r *ColumnDefinition) GetTotal() int { + return *r.total +} + +func (r *ColumnDefinition) GetType() string { + return *r.ttype +} diff --git a/database/schema/grammars/mysql.go b/database/schema/grammars/mysql.go new file mode 100644 index 000000000..d97f0671b --- /dev/null +++ b/database/schema/grammars/mysql.go @@ -0,0 +1,251 @@ +package grammars + +import ( + schemacontract "github.com/goravel/framework/contracts/database/schema" +) + +type Mysql struct{} + +func NewMysql() *Mysql { + return &Mysql{} +} + +func (r *Mysql) CompileAdd(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileAutoIncrementStartingValues(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileChange(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileColumns(database, table string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileCreate(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileCreateEncoding(sql, connection string, blueprint schemacontract.Blueprint) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileCreateEngine(sql, connection string, blueprint schemacontract.Blueprint) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileCreateTable(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileDrop(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileDropAllTables(tables []string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileDropAllViews(views []string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileDropColumn(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileDropIfExists(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileDropIndex(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileDropPrimary(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileDropUnique(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompilePrimary(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileIndex(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileIndexes(database, table string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileRename(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileRenameColumn(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileRenameIndex(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileTableComment(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileTables(database string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileUnique(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) CompileViews(database string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) ModifyNullable(blueprint schemacontract.Blueprint, column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) ModifyDefault(blueprint schemacontract.Blueprint, column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeBigInteger(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeBinary(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeBoolean(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeChar(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeDate(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeDateTime(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeDateTimeTz(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeDecimal(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeDouble(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeEnum(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeFloat(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeInteger(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeJson(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeJsonb(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeString(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeText(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeTime(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeTimeTz(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeTimestamp(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Mysql) TypeTimestampTz(column string) string { + //TODO implement me + panic("implement me") +} diff --git a/database/schema/grammars/postgres.go b/database/schema/grammars/postgres.go new file mode 100644 index 000000000..979971e35 --- /dev/null +++ b/database/schema/grammars/postgres.go @@ -0,0 +1,301 @@ +package grammars + +import ( + "fmt" + "strings" + + ormcontract "github.com/goravel/framework/contracts/database/orm" + schemacontract "github.com/goravel/framework/contracts/database/schema" +) + +type Postgres struct{} + +func NewPostgres() *Postgres { + return &Postgres{} +} + +func (r *Postgres) CompileAdd(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileAutoIncrementStartingValues(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileChange(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileColumns(database, table, schema string) string { + return fmt.Sprintf( + "select a.attname as name, t.typname as type_name, format_type(a.atttypid, a.atttypmod) as type, "+ + "(select tc.collcollate from pg_catalog.pg_collation tc where tc.oid = a.attcollation) as collation, "+ + "not a.attnotnull as nullable, "+ + "(select pg_get_expr(adbin, adrelid) from pg_attrdef where c.oid = pg_attrdef.adrelid and pg_attrdef.adnum = a.attnum) as default, "+ + "col_description(c.oid, a.attnum) as comment "+ + "from pg_attribute a, pg_class c, pg_type t, pg_namespace n "+ + "where c.relname = '%s' and n.nspname = '%s' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid and n.oid = c.relnamespace "+ + "order by a.attnum", table, schema) +} + +func (r *Postgres) CompileCreate(blueprint schemacontract.Blueprint, query ormcontract.Query) string { + return fmt.Sprintf("create table %s (%s)", blueprint.GetTableName(), strings.Join(r.getColumns(blueprint), ",")) +} + +func (r *Postgres) CompileCreateEncoding(sql, connection string, blueprint schemacontract.Blueprint) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileCreateEngine(sql, connection string, blueprint schemacontract.Blueprint) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileCreateTable(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileDrop(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileDropAllTables(tables []string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileDropAllViews(views []string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileDropColumn(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileDropIfExists(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileDropIndex(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileDropPrimary(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileDropUnique(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompilePrimary(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileIndex(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileIndexes(database, table string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileRename(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileRenameColumn(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileRenameIndex(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileTableComment(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileTables(database string) string { + return "select c.relname as name, n.nspname as schema, pg_total_relation_size(c.oid) as size, " + + "obj_description(c.oid, 'pg_class') as comment from pg_class c, pg_namespace n " + + "where c.relkind in ('r', 'p') and n.oid = c.relnamespace and n.nspname not in ('pg_catalog', 'information_schema') " + + "order by c.relname" +} + +func (r *Postgres) CompileUnique(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) CompileViews(database string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) ModifyNullable(blueprint schemacontract.Blueprint, column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) ModifyDefault(blueprint schemacontract.Blueprint, column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Postgres) TypeBigInteger(column schemacontract.ColumnDefinition) string { + if column.GetAutoIncrement() { + return "bigserial" + } + + return "bigint" +} + +func (r *Postgres) TypeBinary(column schemacontract.ColumnDefinition) string { + return "bytea" +} + +func (r *Postgres) TypeBoolean(column schemacontract.ColumnDefinition) string { + return "boolean" +} + +func (r *Postgres) TypeChar(column schemacontract.ColumnDefinition) string { + length := column.GetLength() + if length > 0 { + return fmt.Sprintf("char(%d)", length) + } + + return "char" +} + +func (r *Postgres) TypeDate(column schemacontract.ColumnDefinition) string { + return "date" +} + +func (r *Postgres) TypeDateTime(column schemacontract.ColumnDefinition) string { + return r.TypeTimestamp(column) +} + +func (r *Postgres) TypeDateTimeTz(column schemacontract.ColumnDefinition) string { + return r.TypeTimestampTz(column) +} + +func (r *Postgres) TypeDecimal(column schemacontract.ColumnDefinition) string { + return fmt.Sprintf("decimal(%d, %d)", column.GetTotal(), column.GetPlaces()) +} + +func (r *Postgres) TypeDouble(column schemacontract.ColumnDefinition) string { + return "double precision" +} + +func (r *Postgres) TypeEnum(column schemacontract.ColumnDefinition) string { + return fmt.Sprintf(`varchar(255) check ("%s" in (%s))`, column.GetName(), strings.Join(column.GetAllowed(), ",")) +} + +func (r *Postgres) TypeFloat(column schemacontract.ColumnDefinition) string { + return r.TypeDouble(column) +} + +func (r *Postgres) TypeInteger(column schemacontract.ColumnDefinition) string { + if column.GetAutoIncrement() { + return "serial" + } + + return "integer" +} + +func (r *Postgres) TypeJson(column schemacontract.ColumnDefinition) string { + return "json" +} + +func (r *Postgres) TypeJsonb(column schemacontract.ColumnDefinition) string { + return "jsonb" +} + +func (r *Postgres) TypeString(column schemacontract.ColumnDefinition) string { + length := column.GetLength() + if length > 0 { + return fmt.Sprintf("varchar(%d)", length) + } + + return "varchar" +} + +func (r *Postgres) TypeText(column schemacontract.ColumnDefinition) string { + return "text" +} + +func (r *Postgres) TypeTime(column schemacontract.ColumnDefinition) string { + precision := column.GetPrecision() + if precision > 0 { + return fmt.Sprintf("time(%d) without time zone", precision) + } + + return "time" +} + +func (r *Postgres) TypeTimeTz(column schemacontract.ColumnDefinition) string { + precision := column.GetPrecision() + if precision > 0 { + return fmt.Sprintf("time(%d) with time zone", precision) + } + + return "time" +} + +func (r *Postgres) TypeTimestamp(column schemacontract.ColumnDefinition) string { + precision := column.GetPrecision() + if precision > 0 { + return fmt.Sprintf("timestamp(%d) without time zone", precision) + } + + return "timestamp" +} + +func (r *Postgres) TypeTimestampTz(column schemacontract.ColumnDefinition) string { + precision := column.GetPrecision() + if precision > 0 { + return fmt.Sprintf("timestamp(%d) with time zone", precision) + } + + return "timestamp" +} + +func (r *Postgres) getColumns(blueprint schemacontract.Blueprint) []string { + var columns []string + for _, column := range blueprint.GetAddedColumns() { + columns = append(columns, fmt.Sprintf("%s %s", column.GetName(), r.getType(column))) + } + + return columns +} + +func (r *Postgres) getType(column schemacontract.ColumnDefinition) string { + switch column.GetType() { + case "char": + return r.TypeChar(column) + case "string": + return r.TypeString(column) + default: + panic(fmt.Sprintf("unsupported column type: %s", column.GetType())) + } +} diff --git a/database/schema/grammars/postgres_test.go b/database/schema/grammars/postgres_test.go new file mode 100644 index 000000000..05aeb74e1 --- /dev/null +++ b/database/schema/grammars/postgres_test.go @@ -0,0 +1,172 @@ +package grammars + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + schemacontract "github.com/goravel/framework/contracts/database/schema" + mockschema "github.com/goravel/framework/mocks/database/schema" +) + +type PostgresSuite struct { + suite.Suite + grammar *Postgres +} + +func TestPostgresSuite(t *testing.T) { + suite.Run(t, &PostgresSuite{}) +} + +func (s *PostgresSuite) SetupTest() { + s.grammar = NewPostgres() +} + +func (s *PostgresSuite) TestCompileCreate() { + mockColumn1 := &mockschema.Column{} + mockColumn1.On("GetName").Return("id").Once() + mockColumn1.On("GetType").Return("string").Once() + mockColumn1.On("GetLength").Return(100).Once() + mockColumn2 := &mockschema.Column{} + mockColumn2.On("GetName").Return("name").Once() + mockColumn2.On("GetType").Return("string").Once() + mockColumn2.On("GetLength").Return(0).Once() + mockBlueprint := &mockschema.Blueprint{} + mockBlueprint.On("GetTableName").Return("users").Once() + mockBlueprint.On("GetAddedColumns").Return([]schemacontract.ColumnDefinition{ + mockColumn1, mockColumn2, + }).Once() + + s.Equal("create table users (id varchar(100),name varchar)", + s.grammar.CompileCreate(mockBlueprint, nil)) +} + +func (s *PostgresSuite) TestTypeBigInteger() { + mockColumn1 := &mockschema.Column{} + mockColumn1.On("GetAutoIncrement").Return(true).Once() + + s.Equal("bigserial", s.grammar.TypeBigInteger(mockColumn1)) + + mockColumn2 := &mockschema.Column{} + mockColumn2.On("GetAutoIncrement").Return(false).Once() + + s.Equal("bigint", s.grammar.TypeBigInteger(mockColumn2)) +} + +func (s *PostgresSuite) TestTypeChar() { + mockColumn1 := &mockschema.Column{} + mockColumn1.On("GetLength").Return(100).Once() + + s.Equal("char(100)", s.grammar.TypeChar(mockColumn1)) + + mockColumn2 := &mockschema.Column{} + mockColumn2.On("GetLength").Return(0).Once() + + s.Equal("char", s.grammar.TypeChar(mockColumn2)) +} + +func (s *PostgresSuite) TestTypeDecimal() { + mockColumn := &mockschema.Column{} + mockColumn.On("GetTotal").Return(4).Once() + mockColumn.On("GetPlaces").Return(2).Once() + + s.Equal("decimal(4, 2)", s.grammar.TypeDecimal(mockColumn)) +} + +func (s *PostgresSuite) TestTypeEnum() { + mockColumn := &mockschema.Column{} + mockColumn.On("GetName").Return("name").Once() + mockColumn.On("GetAllowed").Return([]string{"a", "b"}).Once() + + s.Equal(`varchar(255) check ("name" in (a,b))`, s.grammar.TypeEnum(mockColumn)) +} + +func (s *PostgresSuite) TestTypeInteger() { + mockColumn1 := &mockschema.Column{} + mockColumn1.On("GetAutoIncrement").Return(true).Once() + + s.Equal("serial", s.grammar.TypeInteger(mockColumn1)) + + mockColumn2 := &mockschema.Column{} + mockColumn2.On("GetAutoIncrement").Return(false).Once() + + s.Equal("integer", s.grammar.TypeInteger(mockColumn2)) +} + +func (s *PostgresSuite) TestTypeString() { + mockColumn1 := &mockschema.Column{} + mockColumn1.On("GetLength").Return(100).Once() + + s.Equal("varchar(100)", s.grammar.TypeString(mockColumn1)) + + mockColumn2 := &mockschema.Column{} + mockColumn2.On("GetLength").Return(0).Once() + + s.Equal("varchar", s.grammar.TypeString(mockColumn2)) +} + +func (s *PostgresSuite) TestTypeTime() { + mockColumn1 := &mockschema.Column{} + mockColumn1.On("GetPrecision").Return(1).Once() + + s.Equal("time(1) without time zone", s.grammar.TypeTime(mockColumn1)) + + mockColumn2 := &mockschema.Column{} + mockColumn2.On("GetPrecision").Return(0).Once() + + s.Equal("time", s.grammar.TypeTime(mockColumn2)) +} + +func (s *PostgresSuite) TestTypeTimeTz() { + mockColumn1 := &mockschema.Column{} + mockColumn1.On("GetPrecision").Return(1).Once() + + s.Equal("time(1) with time zone", s.grammar.TypeTimeTz(mockColumn1)) + + mockColumn2 := &mockschema.Column{} + mockColumn2.On("GetPrecision").Return(0).Once() + + s.Equal("time", s.grammar.TypeTimeTz(mockColumn2)) +} + +func (s *PostgresSuite) TestTypeTimestamp() { + mockColumn1 := &mockschema.Column{} + mockColumn1.On("GetPrecision").Return(1).Once() + + s.Equal("timestamp(1) without time zone", s.grammar.TypeTimestamp(mockColumn1)) + + mockColumn2 := &mockschema.Column{} + mockColumn2.On("GetPrecision").Return(0).Once() + + s.Equal("timestamp", s.grammar.TypeTimestamp(mockColumn2)) +} + +func (s *PostgresSuite) TestTypeTimestampTz() { + mockColumn1 := &mockschema.Column{} + mockColumn1.On("GetPrecision").Return(1).Once() + + s.Equal("timestamp(1) with time zone", s.grammar.TypeTimestampTz(mockColumn1)) + + mockColumn2 := &mockschema.Column{} + mockColumn2.On("GetPrecision").Return(0).Once() + + s.Equal("timestamp", s.grammar.TypeTimestampTz(mockColumn2)) +} + +func (s *PostgresSuite) TestGetColumns() { + mockColumn1 := &mockschema.Column{} + mockColumn1.On("GetName").Return("id").Once() + mockColumn1.On("GetType").Return("string").Once() + mockColumn1.On("GetLength").Return(100).Once() + mockColumn2 := &mockschema.Column{} + mockColumn2.On("GetName").Return("name").Once() + mockColumn2.On("GetType").Return("string").Once() + mockColumn2.On("GetLength").Return(0).Once() + mockBlueprint := &mockschema.Blueprint{} + mockBlueprint.On("GetTableName").Return("users").Once() + mockBlueprint.On("GetAddedColumns").Return([]schemacontract.ColumnDefinition{ + mockColumn1, mockColumn2, + }).Once() + + s.Equal([]string{"id varchar(100)", "name varchar"}, s.grammar.getColumns(mockBlueprint)) +} diff --git a/database/schema/grammars/sqlite.go b/database/schema/grammars/sqlite.go new file mode 100644 index 000000000..8d9af95e9 --- /dev/null +++ b/database/schema/grammars/sqlite.go @@ -0,0 +1,251 @@ +package grammars + +import ( + schemacontract "github.com/goravel/framework/contracts/database/schema" +) + +type Sqlite struct{} + +func NewSqlite() *Sqlite { + return &Sqlite{} +} + +func (r *Sqlite) CompileAdd(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileAutoIncrementStartingValues(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileChange(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileColumns(database, table string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileCreate(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileCreateEncoding(sql, connection string, blueprint schemacontract.Blueprint) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileCreateEngine(sql, connection string, blueprint schemacontract.Blueprint) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileCreateTable(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileDrop(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileDropAllTables(tables []string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileDropAllViews(views []string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileDropColumn(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileDropIfExists(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileDropIndex(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileDropPrimary(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileDropUnique(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompilePrimary(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileIndex(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileIndexes(database, table string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileRename(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileRenameColumn(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileRenameIndex(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileTableComment(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileTables(database string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileUnique(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) CompileViews(database string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) ModifyNullable(blueprint schemacontract.Blueprint, column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) ModifyDefault(blueprint schemacontract.Blueprint, column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeBigInteger(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeBinary(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeBoolean(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeChar(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeDate(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeDateTime(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeDateTimeTz(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeDecimal(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeDouble(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeEnum(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeFloat(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeInteger(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeJson(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeJsonb(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeString(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeText(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeTime(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeTimeTz(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeTimestamp(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlite) TypeTimestampTz(column string) string { + //TODO implement me + panic("implement me") +} diff --git a/database/schema/grammars/sqlserver.go b/database/schema/grammars/sqlserver.go new file mode 100644 index 000000000..55b82e08c --- /dev/null +++ b/database/schema/grammars/sqlserver.go @@ -0,0 +1,251 @@ +package grammars + +import ( + schemacontract "github.com/goravel/framework/contracts/database/schema" +) + +type Sqlserver struct{} + +func NewSqlserver() *Sqlserver { + return &Sqlserver{} +} + +func (r *Sqlserver) CompileAdd(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileAutoIncrementStartingValues(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileChange(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileColumns(database, table string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileCreate(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileCreateEncoding(sql, connection string, blueprint schemacontract.Blueprint) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileCreateEngine(sql, connection string, blueprint schemacontract.Blueprint) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileCreateTable(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileDrop(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileDropAllTables(tables []string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileDropAllViews(views []string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileDropColumn(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileDropIfExists(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileDropIndex(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileDropPrimary(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileDropUnique(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompilePrimary(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileIndex(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileIndexes(database, table string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileRename(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileRenameColumn(blueprint schemacontract.Blueprint, command, connection string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileRenameIndex(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileTableComment(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileTables(database string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileUnique(blueprint schemacontract.Blueprint, command string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) CompileViews(database string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) ModifyNullable(blueprint schemacontract.Blueprint, column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) ModifyDefault(blueprint schemacontract.Blueprint, column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeBigInteger(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeBinary(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeBoolean(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeChar(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeDate(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeDateTime(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeDateTimeTz(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeDecimal(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeDouble(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeEnum(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeFloat(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeInteger(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeJson(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeJsonb(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeString(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeText(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeTime(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeTimeTz(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeTimestamp(column string) string { + //TODO implement me + panic("implement me") +} + +func (r *Sqlserver) TypeTimestampTz(column string) string { + //TODO implement me + panic("implement me") +} diff --git a/database/schema/main_test.go b/database/schema/main_test.go new file mode 100644 index 000000000..73f3a6233 --- /dev/null +++ b/database/schema/main_test.go @@ -0,0 +1,31 @@ +package schema + +import ( + "log" + "testing" + + supportdocker "github.com/goravel/framework/support/docker" + "github.com/goravel/framework/support/env" +) + +var testDatabaseDocker *supportdocker.Database + +func TestMain(m *testing.M) { + if !env.IsWindows() { + var err error + testDatabaseDocker, err = supportdocker.InitDatabase() + if err != nil { + log.Fatalf("Init docker error: %s", err) + } + } + + m.Run() + + if !env.IsWindows() { + defer func() { + if err := testDatabaseDocker.Stop(); err != nil { + log.Fatalf("Stop docker error: %s", err) + } + }() + } +} diff --git a/database/schema/schema.go b/database/schema/schema.go new file mode 100644 index 000000000..a4dbeb965 --- /dev/null +++ b/database/schema/schema.go @@ -0,0 +1,222 @@ +package schema + +import ( + "fmt" + "strings" + + configcontract "github.com/goravel/framework/contracts/config" + ormcontract "github.com/goravel/framework/contracts/database/orm" + schemacontract "github.com/goravel/framework/contracts/database/schema" + logcontract "github.com/goravel/framework/contracts/log" + "github.com/goravel/framework/database/processors" + "github.com/goravel/framework/database/schema/grammars" +) + +type Schema struct { + config configcontract.Config + connection string + grammar schemacontract.Grammar + log logcontract.Log + migrations []schemacontract.Migration + orm ormcontract.Orm + processor schemacontract.Processor + query ormcontract.Query +} + +func NewSchema(connection string, config configcontract.Config, orm ormcontract.Orm, log logcontract.Log) (*Schema, error) { + if connection == "" { + connection = config.GetString("database.default") + } + + schema := &Schema{ + config: config, + connection: connection, + log: log, + orm: orm, + query: orm.Connection(connection).Query(), + } + + if err := schema.initGrammarAndProcess(); err != nil { + return nil, err + } + + return schema, nil +} + +func (r *Schema) Connection(name string) schemacontract.Schema { + schema, err := NewSchema(name, r.config, r.orm, r.log) + if err != nil { + panic(err) + } + + return schema +} + +func (r *Schema) Create(table string, callback func(table schemacontract.Blueprint)) error { + blueprint := NewBlueprint(r.getTablePrefix(), table) + blueprint.Create() + callback(blueprint) + + return blueprint.Build(r.query, r.grammar) +} + +func (r *Schema) Drop(table string) error { + //TODO implement me + panic("implement me") +} + +func (r *Schema) DropAllTables() error { + //TODO implement me + panic("implement me") +} + +func (r *Schema) DropAllViews() error { + //TODO implement me + panic("implement me") +} + +func (r *Schema) DropColumns(table string, columns []string) error { + //TODO implement me + panic("implement me") +} + +func (r *Schema) DropIfExists(table string) error { + //TODO implement me + panic("implement me") +} + +func (r *Schema) GetColumns(table string) ([]schemacontract.Column, error) { + database, schema, table := r.parseDatabaseAndSchemaAndTable(table) + table = r.getTablePrefix() + table + + var columns []schemacontract.Column + if err := r.query.Raw(r.grammar.CompileColumns(database, table, schema)).Scan(&columns); err != nil { + return nil, err + } + + return r.processor.ProcessColumns(columns), nil +} + +func (r *Schema) GetColumnListing(table string) []string { + //TODO implement me + panic("implement me") +} + +func (r *Schema) GetIndexes(table string) []schemacontract.Index { + //TODO implement me + panic("implement me") +} + +func (r *Schema) GetIndexListing(table string) []string { + //TODO implement me + panic("implement me") +} + +func (r *Schema) GetTableListing() []string { + //TODO implement me + panic("implement me") +} + +func (r *Schema) GetTables() ([]schemacontract.Table, error) { + var tables []schemacontract.Table + if err := r.query.Raw(r.grammar.CompileTables("")).Scan(&tables); err != nil { + return nil, err + } + + return tables, nil +} + +func (r *Schema) GetViews() []schemacontract.View { + //TODO implement me + panic("implement me") +} + +func (r *Schema) HasColumn(table, column string) bool { + //TODO implement me + panic("implement me") +} + +func (r *Schema) HasColumns(table string, columns []string) bool { + //TODO implement me + panic("implement me") +} + +func (r *Schema) HasIndex(table, index string) { + //TODO implement me + panic("implement me") +} + +func (r *Schema) HasTable(name string) bool { + tables, err := r.GetTables() + if err != nil { + r.log.Errorf("failed to get %s tables: %v", r.connection, err) + return false + } + + for _, table := range tables { + if table.Name == name { + return true + } + } + + return false +} + +func (r *Schema) HasView(view string) bool { + //TODO implement me + panic("implement me") +} + +func (r *Schema) Register(migrations []schemacontract.Migration) { + r.migrations = append(r.migrations, migrations...) +} + +func (r *Schema) Rename(from, to string) { + //TODO implement me + panic("implement me") +} + +func (r *Schema) Table(table string, callback func(table schemacontract.Blueprint)) error { + //TODO implement me + panic("implement me") +} + +func (r *Schema) initGrammarAndProcess() error { + switch r.query.Driver() { + //case ormcontract.DriverMysql: + // grammar = grammars.NewMysql() + case ormcontract.DriverPostgres: + r.grammar = grammars.NewPostgres() + r.processor = processors.NewPostgres() + return nil + //case ormcontract.DriverSqlserver: + // grammar = grammars.NewSqlserver() + //case ormcontract.DriverSqlite: + // grammar = grammars.NewSqlite() + default: + return fmt.Errorf("unsupported database driver: %s", r.query.Driver()) + } +} + +func (r *Schema) getTablePrefix() string { + return r.config.GetString(fmt.Sprintf("database.connections.%s.prefix", r.connection)) +} + +// parseSchemaAndTable Parse the database object reference and extract the database, schema, and table. +func (r *Schema) parseDatabaseAndSchemaAndTable(reference string) (database, schema, table string) { + parts := strings.Split(reference, ".") + database = r.config.GetString(fmt.Sprintf("database.connections.%s.database", r.connection)) + schema = r.config.GetString(fmt.Sprintf("database.connections.%s.schema", r.connection)) + if schema == "" { + schema = "public" + } + + if len(parts) == 2 { + schema = parts[0] + parts = parts[1:] + } + + table = parts[0] + + return +} diff --git a/database/schema/schema_test.go b/database/schema/schema_test.go new file mode 100644 index 000000000..2babfcdc2 --- /dev/null +++ b/database/schema/schema_test.go @@ -0,0 +1,259 @@ +package schema + +import ( + "fmt" + "log" + "reflect" + "testing" + + "github.com/stretchr/testify/suite" + + ormcontract "github.com/goravel/framework/contracts/database/orm" + schemacontract "github.com/goravel/framework/contracts/database/schema" + testingcontract "github.com/goravel/framework/contracts/testing" + "github.com/goravel/framework/database/gorm" + configmock "github.com/goravel/framework/mocks/config" + ormmock "github.com/goravel/framework/mocks/database/orm" + logmock "github.com/goravel/framework/mocks/log" + "github.com/goravel/framework/support/env" +) + +type TestSchema struct { + dbConfig testingcontract.DatabaseConfig + driver ormcontract.Driver + mockConfig *configmock.Config + mockOrm *ormmock.Orm + mockLog *logmock.Log + query ormcontract.Query + schema *Schema +} + +type SchemaSuite struct { + suite.Suite + schemas []TestSchema + //mysqlQuery ormcontract.Query + postgresQuery ormcontract.Query + //sqliteQuery ormcontract.Query + //sqlserverDB ormcontract.Query +} + +func TestSchemaSuite(t *testing.T) { + if env.IsWindows() { + t.Skip("Skipping tests of using docker") + } + + if err := testDatabaseDocker.Fresh(); err != nil { + t.Fatal(err) + } + + //mysqlDocker := gorm.NewMysqlDocker(testDatabaseDocker) + //mysqlQuery, err := mysqlDocker.New() + //if err != nil { + // log.Fatalf("Init mysql docker error: %v", err) + //} + + postgresqlDocker := gorm.NewPostgresqlDocker(testDatabaseDocker) + postgresqlQuery, err := postgresqlDocker.New() + if err != nil { + log.Fatalf("Init postgresql docker error: %v", err) + } + + //sqliteDocker := gorm.NewSqliteDocker("goravel") + //sqliteQuery, err := sqliteDocker.New() + //if err != nil { + // log.Fatalf("Get sqlite error: %s", err) + //} + // + //sqlserverDocker := gorm.NewSqlserverDocker(testDatabaseDocker) + //sqlserverQuery, err := sqlserverDocker.New() + //if err != nil { + // log.Fatalf("Init sqlserver docker error: %v", err) + //} + + suite.Run(t, &SchemaSuite{ + //mysqlQuery: mysqlQuery, + postgresQuery: postgresqlQuery, + //sqliteQuery: sqliteQuery, + //sqlserverDB: sqlserverQuery, + }) + + //assert.Nil(t, file.Remove("goravel")) +} + +func (s *SchemaSuite) SetupTest() { + mockConfig := &configmock.Config{} + mockOrm := &ormmock.Orm{} + //mockOrmOfConnection := &ormmock.Orm{} + mockLog := &logmock.Log{} + mockConfig.On("GetString", "database.default").Return("mysql").Once() + mockOrm.On("Connection", "mysql").Return(mockOrm).Once() + mockOrm.On("Query").Return(s.postgresQuery).Once() + postgresSchema, err := NewSchema("", mockConfig, mockOrm, mockLog) + s.Nil(err) + s.schemas = append(s.schemas, TestSchema{ + dbConfig: testDatabaseDocker.Postgres.Config(), + driver: ormcontract.DriverPostgres, + mockConfig: mockConfig, + mockOrm: mockOrm, + mockLog: mockLog, + query: s.postgresQuery, + schema: postgresSchema, + }) +} + +func (s *SchemaSuite) TestConnection() { + for _, schema := range s.schemas { + schema.mockOrm.On("Connection", "postgres").Return(schema.mockOrm).Once() + schema.mockOrm.On("Query").Return(schema.query).Once() + s.NotNil(schema.schema.Connection("postgres")) + + schema.mockOrm.AssertExpectations(s.T()) + } +} + +func (s *SchemaSuite) TestCreate() { + for _, schema := range s.schemas { + s.Run(schema.driver.String(), func() { + schema.mockConfig.On("GetString", fmt.Sprintf("database.connections.%s.prefix", schema.schema.connection)). + Return("goravel_").Once() + + err := schema.schema.Create("create", func(table schemacontract.Blueprint) { + table.String("name") + }) + s.Nil(err) + s.True(schema.schema.HasTable("goravel_create")) + }) + } +} + +func (s *SchemaSuite) TestGetColumns() { + for _, schema := range s.schemas { + s.Run(schema.driver.String(), func() { + table := "get_columns" + schema.mockConfig.On("GetString", fmt.Sprintf("database.connections.%s.database", schema.schema.connection)). + Return(schema.dbConfig.Database).Once() + schema.mockConfig.On("GetString", fmt.Sprintf("database.connections.%s.schema", schema.schema.connection)). + Return("").Once() + schema.mockConfig.On("GetString", fmt.Sprintf("database.connections.%s.prefix", schema.schema.connection)). + Return("").Twice() + + err := schema.schema.Create(table, func(table schemacontract.Blueprint) { + table.Char("char") + table.String("string") + }) + + s.Nil(err) + s.True(schema.schema.HasTable(table)) + + columns, err := schema.schema.GetColumns(table) + + s.Nil(err) + s.Equal(2, len(columns)) + for _, column := range columns { + if column.Name == "char" { + s.False(column.AutoIncrement) + s.Empty(column.Collation) + s.Empty(column.Comment) + s.Nil(column.Default) + s.True(column.Nullable) + s.Equal("character(255)", column.Type) + s.Equal("bpchar", column.TypeName) + } + if column.Name == "string" { + s.False(column.AutoIncrement) + s.Empty(column.Collation) + s.Empty(column.Comment) + s.Nil(column.Default) + s.True(column.Nullable) + s.Equal("character varying(255)", column.Type) + s.Equal("varchar", column.TypeName) + } + } + + schema.mockConfig.AssertExpectations(s.T()) + }) + } +} + +func (s *SchemaSuite) TestGetTables() { + for _, schema := range s.schemas { + s.Run(schema.driver.String(), func() { + tables, err := schema.schema.GetTables() + s.Greater(len(tables), 0) + s.Nil(err) + }) + } +} + +func (s *SchemaSuite) TestHasTable() { + for _, schema := range s.schemas { + s.Run(schema.driver.String(), func() { + s.True(schema.schema.HasTable("users")) + s.False(schema.schema.HasTable("unknow")) + }) + } +} + +func (s *SchemaSuite) TestInitGrammarAndProcess() { + for _, schema := range s.schemas { + s.Run(schema.driver.String(), func() { + s.Nil(schema.schema.initGrammarAndProcess()) + grammarType := reflect.TypeOf(schema.schema.grammar) + grammarName := grammarType.Elem().Name() + processorType := reflect.TypeOf(schema.schema.processor) + processorName := processorType.Elem().Name() + + switch schema.driver { + case ormcontract.DriverMysql: + s.Equal("Mysql", grammarName) + s.Equal("Mysql", processorName) + case ormcontract.DriverPostgres: + s.Equal("Postgres", grammarName) + s.Equal("Postgres", processorName) + case ormcontract.DriverSqlserver: + s.Equal("Sqlserver", grammarName) + s.Equal("Sqlserver", processorName) + case ormcontract.DriverSqlite: + s.Equal("Sqlite", grammarName) + s.Equal("Sqlite", processorName) + default: + s.Fail("unsupported database driver") + } + }) + } +} + +func (s *SchemaSuite) TestParseDatabaseAndSchemaAndTable() { + for _, schema := range s.schemas { + s.Run(schema.driver.String(), func() { + schema.mockConfig.On("GetString", fmt.Sprintf("database.connections.%s.database", schema.schema.connection)). + Return(schema.dbConfig.Database).Once() + schema.mockConfig.On("GetString", fmt.Sprintf("database.connections.%s.schema", schema.schema.connection)). + Return("").Once() + database, schemaName, table := schema.schema.parseDatabaseAndSchemaAndTable("users") + s.Equal(schema.dbConfig.Database, database) + s.Equal("public", schemaName) + s.Equal("users", table) + + schema.mockConfig.On("GetString", fmt.Sprintf("database.connections.%s.database", schema.schema.connection)). + Return(schema.dbConfig.Database).Once() + schema.mockConfig.On("GetString", fmt.Sprintf("database.connections.%s.schema", schema.schema.connection)). + Return("").Once() + database, schemaName, table = schema.schema.parseDatabaseAndSchemaAndTable("goravel.users") + s.Equal(schema.dbConfig.Database, database) + s.Equal("goravel", schemaName) + s.Equal("users", table) + + schema.mockConfig.On("GetString", fmt.Sprintf("database.connections.%s.database", schema.schema.connection)). + Return(schema.dbConfig.Database).Once() + schema.mockConfig.On("GetString", fmt.Sprintf("database.connections.%s.schema", schema.schema.connection)). + Return("hello").Once() + database, schemaName, table = schema.schema.parseDatabaseAndSchemaAndTable("goravel.users") + s.Equal(schema.dbConfig.Database, database) + s.Equal("goravel", schemaName) + s.Equal("users", table) + + schema.mockConfig.AssertExpectations(s.T()) + }) + } +} diff --git a/database/factory.go b/database/seeder/factory.go similarity index 99% rename from database/factory.go rename to database/seeder/factory.go index e870bbd57..20bacd8d8 100644 --- a/database/factory.go +++ b/database/seeder/factory.go @@ -1,4 +1,4 @@ -package database +package seeder import ( "errors" diff --git a/database/factory_test.go b/database/seeder/factory_test.go similarity index 98% rename from database/factory_test.go rename to database/seeder/factory_test.go index aaae64503..830a0b0ad 100644 --- a/database/factory_test.go +++ b/database/seeder/factory_test.go @@ -1,4 +1,4 @@ -package database +package seeder import ( "log" @@ -17,6 +17,13 @@ import ( "github.com/goravel/framework/support/env" ) +type User struct { + orm.Model + orm.SoftDeletes + Name string + Avatar string +} + func (u *User) Factory() factory.Factory { return &UserFactory{} } diff --git a/database/seeder/main_test.go b/database/seeder/main_test.go new file mode 100644 index 000000000..8df9d0a3e --- /dev/null +++ b/database/seeder/main_test.go @@ -0,0 +1,31 @@ +package seeder + +import ( + "log" + "testing" + + supportdocker "github.com/goravel/framework/support/docker" + "github.com/goravel/framework/support/env" +) + +var testDatabaseDocker *supportdocker.Database + +func TestMain(m *testing.M) { + if !env.IsWindows() { + var err error + testDatabaseDocker, err = supportdocker.InitDatabase() + if err != nil { + log.Fatalf("Init docker error: %s", err) + } + } + + m.Run() + + if !env.IsWindows() { + defer func() { + if err := testDatabaseDocker.Stop(); err != nil { + log.Fatalf("Stop docker error: %s", err) + } + }() + } +} diff --git a/database/seeder.go b/database/seeder/seeder.go similarity index 77% rename from database/seeder.go rename to database/seeder/seeder.go index 862dff481..ddd855709 100644 --- a/database/seeder.go +++ b/database/seeder/seeder.go @@ -1,20 +1,21 @@ -package database +package seeder import ( "github.com/gookit/color" + "github.com/goravel/framework/contracts/database/seeder" ) -type SeederFacade struct { +type Seeder struct { Seeders []seeder.Seeder Called []string } -func NewSeederFacade() *SeederFacade { - return &SeederFacade{} +func NewSeeder() *Seeder { + return &Seeder{} } -func (s *SeederFacade) Register(seeders []seeder.Seeder) { +func (s *Seeder) Register(seeders []seeder.Seeder) { existingSignatures := make(map[string]bool) for _, seeder := range seeders { @@ -29,7 +30,7 @@ func (s *SeederFacade) Register(seeders []seeder.Seeder) { } } -func (s *SeederFacade) GetSeeder(name string) seeder.Seeder { +func (s *Seeder) GetSeeder(name string) seeder.Seeder { var seeder seeder.Seeder for _, item := range s.Seeders { if item.Signature() == name { @@ -41,12 +42,12 @@ func (s *SeederFacade) GetSeeder(name string) seeder.Seeder { return seeder } -func (s *SeederFacade) GetSeeders() []seeder.Seeder { +func (s *Seeder) GetSeeders() []seeder.Seeder { return s.Seeders } // Call executes the specified seeder(s). -func (s *SeederFacade) Call(seeders []seeder.Seeder) error { +func (s *Seeder) Call(seeders []seeder.Seeder) error { for _, seeder := range seeders { signature := seeder.Signature() @@ -62,7 +63,7 @@ func (s *SeederFacade) Call(seeders []seeder.Seeder) error { } // CallOnce executes the specified seeder(s) only if they haven't been executed before. -func (s *SeederFacade) CallOnce(seeders []seeder.Seeder) error { +func (s *Seeder) CallOnce(seeders []seeder.Seeder) error { for _, item := range seeders { signature := item.Signature() diff --git a/database/seeder_test.go b/database/seeder/seeder_test.go similarity index 96% rename from database/seeder_test.go rename to database/seeder/seeder_test.go index 7c97a7cf5..bfb52d120 100644 --- a/database/seeder_test.go +++ b/database/seeder/seeder_test.go @@ -1,4 +1,4 @@ -package database +package seeder import ( "log" @@ -11,7 +11,7 @@ import ( type SeederTestSuite struct { suite.Suite - seederFacade *SeederFacade + seederFacade *Seeder } func TestSeederTestSuite(t *testing.T) { @@ -19,7 +19,7 @@ func TestSeederTestSuite(t *testing.T) { } func (s *SeederTestSuite) SetupTest() { - s.seederFacade = NewSeederFacade() + s.seederFacade = NewSeeder() } func (s *SeederTestSuite) TestRegister() { diff --git a/database/service_provider.go b/database/service_provider.go index 315f57f41..2b59052f8 100644 --- a/database/service_provider.go +++ b/database/service_provider.go @@ -7,9 +7,12 @@ import ( consolecontract "github.com/goravel/framework/contracts/console" "github.com/goravel/framework/contracts/foundation" "github.com/goravel/framework/database/console" + "github.com/goravel/framework/database/schema" + "github.com/goravel/framework/database/seeder" ) const BindingOrm = "goravel.orm" +const BindingSchema = "goravel.schema" const BindingSeeder = "goravel.seeder" type ServiceProvider struct { @@ -27,8 +30,11 @@ func (database *ServiceProvider) Register(app foundation.Application) { return orm, nil }) + app.Bind(BindingSchema, func(app foundation.Application) (any, error) { + return schema.NewSchema("", app.MakeConfig(), app.MakeOrm(), app.MakeLog()) + }) app.Singleton(BindingSeeder, func(app foundation.Application) (any, error) { - return NewSeederFacade(), nil + return seeder.NewSeeder(), nil }) } diff --git a/facades/schema.go b/facades/schema.go new file mode 100644 index 000000000..a1b43afc4 --- /dev/null +++ b/facades/schema.go @@ -0,0 +1,9 @@ +package facades + +import ( + "github.com/goravel/framework/contracts/database/schema" +) + +func Schema() schema.Schema { + return App().MakeSchema() +} diff --git a/foundation/container.go b/foundation/container.go index 2206a9317..a4d114bfa 100644 --- a/foundation/container.go +++ b/foundation/container.go @@ -18,6 +18,7 @@ import ( consolecontract "github.com/goravel/framework/contracts/console" cryptcontract "github.com/goravel/framework/contracts/crypt" ormcontract "github.com/goravel/framework/contracts/database/orm" + schemacontract "github.com/goravel/framework/contracts/database/schema" seerdercontract "github.com/goravel/framework/contracts/database/seeder" eventcontract "github.com/goravel/framework/contracts/event" filesystemcontract "github.com/goravel/framework/contracts/filesystem" @@ -256,6 +257,28 @@ func (c *Container) MakeSchedule() schedulecontract.Schedule { return instance.(schedulecontract.Schedule) } +func (c *Container) MakeSchema() schemacontract.Schema { + instance, err := c.Make(database.BindingSchema) + + if err != nil { + color.Redln(err) + return nil + } + + return instance.(schemacontract.Schema) +} + +func (c *Container) MakeSeeder() seerdercontract.Facade { + instance, err := c.Make(database.BindingSeeder) + + if err != nil { + color.Redln(err) + return nil + } + + return instance.(seerdercontract.Facade) +} + func (c *Container) MakeSession() sessioncontract.Manager { instance, err := c.Make(session.Binding) if err != nil { @@ -306,17 +329,6 @@ func (c *Container) MakeView() httpcontract.View { return instance.(httpcontract.View) } -func (c *Container) MakeSeeder() seerdercontract.Facade { - instance, err := c.Make(database.BindingSeeder) - - if err != nil { - color.Redln(err) - return nil - } - - return instance.(seerdercontract.Facade) -} - func (c *Container) MakeWith(key any, parameters map[string]any) (any, error) { return c.make(key, parameters) } diff --git a/mocks/auth/Auth.go b/mocks/auth/Auth.go index b041ecf0d..8391a9e48 100644 --- a/mocks/auth/Auth.go +++ b/mocks/auth/Auth.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/auth/access/Gate.go b/mocks/auth/access/Gate.go index 73a668e9f..da65287bc 100644 --- a/mocks/auth/access/Gate.go +++ b/mocks/auth/access/Gate.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/auth/access/Response.go b/mocks/auth/access/Response.go index 56d9d3314..e2e12b641 100644 --- a/mocks/auth/access/Response.go +++ b/mocks/auth/access/Response.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/cache/Cache.go b/mocks/cache/Cache.go index 90e8a18b2..328260db2 100644 --- a/mocks/cache/Cache.go +++ b/mocks/cache/Cache.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/cache/Driver.go b/mocks/cache/Driver.go index 433a646fb..52d077b63 100644 --- a/mocks/cache/Driver.go +++ b/mocks/cache/Driver.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/cache/Lock.go b/mocks/cache/Lock.go index 61e5f1949..96937b018 100644 --- a/mocks/cache/Lock.go +++ b/mocks/cache/Lock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/config/Config.go b/mocks/config/Config.go index 3d0fccf33..0cc3782c7 100644 --- a/mocks/config/Config.go +++ b/mocks/config/Config.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/console/Artisan.go b/mocks/console/Artisan.go index 80b4d75c6..e1a6c23a4 100644 --- a/mocks/console/Artisan.go +++ b/mocks/console/Artisan.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/console/Command.go b/mocks/console/Command.go index 8272df979..2db57eb21 100644 --- a/mocks/console/Command.go +++ b/mocks/console/Command.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/console/Context.go b/mocks/console/Context.go index a752463c0..3936cc1c8 100644 --- a/mocks/console/Context.go +++ b/mocks/console/Context.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/console/command/Flag.go b/mocks/console/command/Flag.go index 31d849e41..b18cf10e5 100644 --- a/mocks/console/command/Flag.go +++ b/mocks/console/command/Flag.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/crypt/Crypt.go b/mocks/crypt/Crypt.go index fd3af7b6c..f79c713f1 100644 --- a/mocks/crypt/Crypt.go +++ b/mocks/crypt/Crypt.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/factory/Factory.go b/mocks/database/factory/Factory.go index c9b34a66d..c79cd67d5 100644 --- a/mocks/database/factory/Factory.go +++ b/mocks/database/factory/Factory.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/factory/Model.go b/mocks/database/factory/Model.go index ff827fa29..607dbfb38 100644 --- a/mocks/database/factory/Model.go +++ b/mocks/database/factory/Model.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/gorm/Gorm.go b/mocks/database/gorm/Gorm.go index 93ecf0416..fdda35abc 100644 --- a/mocks/database/gorm/Gorm.go +++ b/mocks/database/gorm/Gorm.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/gorm/Initialize.go b/mocks/database/gorm/Initialize.go index 6c6714951..53e22c777 100644 --- a/mocks/database/gorm/Initialize.go +++ b/mocks/database/gorm/Initialize.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/orm/Association.go b/mocks/database/orm/Association.go index b0c5b8d9d..949a7d73f 100644 --- a/mocks/database/orm/Association.go +++ b/mocks/database/orm/Association.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/orm/ConnectionModel.go b/mocks/database/orm/ConnectionModel.go index 533071f4e..d51fb3f1a 100644 --- a/mocks/database/orm/ConnectionModel.go +++ b/mocks/database/orm/ConnectionModel.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/orm/Cursor.go b/mocks/database/orm/Cursor.go index 2d5b09c36..3cce65597 100644 --- a/mocks/database/orm/Cursor.go +++ b/mocks/database/orm/Cursor.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/orm/DispatchesEvents.go b/mocks/database/orm/DispatchesEvents.go index f5d85884f..4aef2ee27 100644 --- a/mocks/database/orm/DispatchesEvents.go +++ b/mocks/database/orm/DispatchesEvents.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/orm/Event.go b/mocks/database/orm/Event.go index f13d94a4e..87a6695c7 100644 --- a/mocks/database/orm/Event.go +++ b/mocks/database/orm/Event.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/orm/Factory.go b/mocks/database/orm/Factory.go index 08de63065..cb481baac 100644 --- a/mocks/database/orm/Factory.go +++ b/mocks/database/orm/Factory.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/orm/Observer.go b/mocks/database/orm/Observer.go index b11976891..b43876258 100644 --- a/mocks/database/orm/Observer.go +++ b/mocks/database/orm/Observer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/orm/Orm.go b/mocks/database/orm/Orm.go index fb36868ee..4c0ec6590 100644 --- a/mocks/database/orm/Orm.go +++ b/mocks/database/orm/Orm.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/orm/Query.go b/mocks/database/orm/Query.go index 67de11415..17334ced2 100644 --- a/mocks/database/orm/Query.go +++ b/mocks/database/orm/Query.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/orm/Transaction.go b/mocks/database/orm/Transaction.go index d8d9ebb6e..2b01bf2da 100644 --- a/mocks/database/orm/Transaction.go +++ b/mocks/database/orm/Transaction.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/schema/Blueprint.go b/mocks/database/schema/Blueprint.go new file mode 100644 index 000000000..0b277bd25 --- /dev/null +++ b/mocks/database/schema/Blueprint.go @@ -0,0 +1,2223 @@ +// Code generated by mockery v2.39.1. DO NOT EDIT. + +package mocks + +import ( + orm "github.com/goravel/framework/contracts/database/orm" + schema "github.com/goravel/framework/contracts/database/schema" + mock "github.com/stretchr/testify/mock" +) + +// Blueprint is an autogenerated mock type for the Blueprint type +type Blueprint struct { + mock.Mock +} + +type Blueprint_Expecter struct { + mock *mock.Mock +} + +func (_m *Blueprint) EXPECT() *Blueprint_Expecter { + return &Blueprint_Expecter{mock: &_m.Mock} +} + +// BigInteger provides a mock function with given fields: column +func (_m *Blueprint) BigInteger(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for BigInteger") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_BigInteger_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BigInteger' +type Blueprint_BigInteger_Call struct { + *mock.Call +} + +// BigInteger is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) BigInteger(column interface{}) *Blueprint_BigInteger_Call { + return &Blueprint_BigInteger_Call{Call: _e.mock.On("BigInteger", column)} +} + +func (_c *Blueprint_BigInteger_Call) Run(run func(column string)) *Blueprint_BigInteger_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_BigInteger_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_BigInteger_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_BigInteger_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_BigInteger_Call { + _c.Call.Return(run) + return _c +} + +// Binary provides a mock function with given fields: column +func (_m *Blueprint) Binary(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for Binary") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Binary_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Binary' +type Blueprint_Binary_Call struct { + *mock.Call +} + +// Binary is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) Binary(column interface{}) *Blueprint_Binary_Call { + return &Blueprint_Binary_Call{Call: _e.mock.On("Binary", column)} +} + +func (_c *Blueprint_Binary_Call) Run(run func(column string)) *Blueprint_Binary_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_Binary_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Binary_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Binary_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_Binary_Call { + _c.Call.Return(run) + return _c +} + +// Boolean provides a mock function with given fields: column +func (_m *Blueprint) Boolean(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for Boolean") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Boolean_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Boolean' +type Blueprint_Boolean_Call struct { + *mock.Call +} + +// Boolean is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) Boolean(column interface{}) *Blueprint_Boolean_Call { + return &Blueprint_Boolean_Call{Call: _e.mock.On("Boolean", column)} +} + +func (_c *Blueprint_Boolean_Call) Run(run func(column string)) *Blueprint_Boolean_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_Boolean_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Boolean_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Boolean_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_Boolean_Call { + _c.Call.Return(run) + return _c +} + +// Build provides a mock function with given fields: query, grammar +func (_m *Blueprint) Build(query orm.Query, grammar schema.Grammar) error { + ret := _m.Called(query, grammar) + + if len(ret) == 0 { + panic("no return value specified for Build") + } + + var r0 error + if rf, ok := ret.Get(0).(func(orm.Query, schema.Grammar) error); ok { + r0 = rf(query, grammar) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Blueprint_Build_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Build' +type Blueprint_Build_Call struct { + *mock.Call +} + +// Build is a helper method to define mock.On call +// - query orm.Query +// - grammar schema.Grammar +func (_e *Blueprint_Expecter) Build(query interface{}, grammar interface{}) *Blueprint_Build_Call { + return &Blueprint_Build_Call{Call: _e.mock.On("Build", query, grammar)} +} + +func (_c *Blueprint_Build_Call) Run(run func(query orm.Query, grammar schema.Grammar)) *Blueprint_Build_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(orm.Query), args[1].(schema.Grammar)) + }) + return _c +} + +func (_c *Blueprint_Build_Call) Return(_a0 error) *Blueprint_Build_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Build_Call) RunAndReturn(run func(orm.Query, schema.Grammar) error) *Blueprint_Build_Call { + _c.Call.Return(run) + return _c +} + +// Char provides a mock function with given fields: column, length +func (_m *Blueprint) Char(column string, length ...int) schema.ColumnDefinition { + _va := make([]interface{}, len(length)) + for _i := range length { + _va[_i] = length[_i] + } + var _ca []interface{} + _ca = append(_ca, column) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for Char") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string, ...int) schema.ColumnDefinition); ok { + r0 = rf(column, length...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Char_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Char' +type Blueprint_Char_Call struct { + *mock.Call +} + +// Char is a helper method to define mock.On call +// - column string +// - length ...int +func (_e *Blueprint_Expecter) Char(column interface{}, length ...interface{}) *Blueprint_Char_Call { + return &Blueprint_Char_Call{Call: _e.mock.On("Char", + append([]interface{}{column}, length...)...)} +} + +func (_c *Blueprint_Char_Call) Run(run func(column string, length ...int)) *Blueprint_Char_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]int, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(int) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *Blueprint_Char_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Char_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Char_Call) RunAndReturn(run func(string, ...int) schema.ColumnDefinition) *Blueprint_Char_Call { + _c.Call.Return(run) + return _c +} + +// Comment provides a mock function with given fields: comment +func (_m *Blueprint) Comment(comment string) error { + ret := _m.Called(comment) + + if len(ret) == 0 { + panic("no return value specified for Comment") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(comment) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Blueprint_Comment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Comment' +type Blueprint_Comment_Call struct { + *mock.Call +} + +// Comment is a helper method to define mock.On call +// - comment string +func (_e *Blueprint_Expecter) Comment(comment interface{}) *Blueprint_Comment_Call { + return &Blueprint_Comment_Call{Call: _e.mock.On("Comment", comment)} +} + +func (_c *Blueprint_Comment_Call) Run(run func(comment string)) *Blueprint_Comment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_Comment_Call) Return(_a0 error) *Blueprint_Comment_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Comment_Call) RunAndReturn(run func(string) error) *Blueprint_Comment_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function with given fields: +func (_m *Blueprint) Create() { + _m.Called() +} + +// Blueprint_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type Blueprint_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +func (_e *Blueprint_Expecter) Create() *Blueprint_Create_Call { + return &Blueprint_Create_Call{Call: _e.mock.On("Create")} +} + +func (_c *Blueprint_Create_Call) Run(run func()) *Blueprint_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Blueprint_Create_Call) Return() *Blueprint_Create_Call { + _c.Call.Return() + return _c +} + +func (_c *Blueprint_Create_Call) RunAndReturn(run func()) *Blueprint_Create_Call { + _c.Call.Return(run) + return _c +} + +// Date provides a mock function with given fields: column +func (_m *Blueprint) Date(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for Date") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Date_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Date' +type Blueprint_Date_Call struct { + *mock.Call +} + +// Date is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) Date(column interface{}) *Blueprint_Date_Call { + return &Blueprint_Date_Call{Call: _e.mock.On("Date", column)} +} + +func (_c *Blueprint_Date_Call) Run(run func(column string)) *Blueprint_Date_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_Date_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Date_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Date_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_Date_Call { + _c.Call.Return(run) + return _c +} + +// DateTime provides a mock function with given fields: column +func (_m *Blueprint) DateTime(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for DateTime") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_DateTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DateTime' +type Blueprint_DateTime_Call struct { + *mock.Call +} + +// DateTime is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) DateTime(column interface{}) *Blueprint_DateTime_Call { + return &Blueprint_DateTime_Call{Call: _e.mock.On("DateTime", column)} +} + +func (_c *Blueprint_DateTime_Call) Run(run func(column string)) *Blueprint_DateTime_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_DateTime_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_DateTime_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_DateTime_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_DateTime_Call { + _c.Call.Return(run) + return _c +} + +// DateTimeTz provides a mock function with given fields: column +func (_m *Blueprint) DateTimeTz(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for DateTimeTz") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_DateTimeTz_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DateTimeTz' +type Blueprint_DateTimeTz_Call struct { + *mock.Call +} + +// DateTimeTz is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) DateTimeTz(column interface{}) *Blueprint_DateTimeTz_Call { + return &Blueprint_DateTimeTz_Call{Call: _e.mock.On("DateTimeTz", column)} +} + +func (_c *Blueprint_DateTimeTz_Call) Run(run func(column string)) *Blueprint_DateTimeTz_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_DateTimeTz_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_DateTimeTz_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_DateTimeTz_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_DateTimeTz_Call { + _c.Call.Return(run) + return _c +} + +// Decimal provides a mock function with given fields: column +func (_m *Blueprint) Decimal(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for Decimal") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Decimal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Decimal' +type Blueprint_Decimal_Call struct { + *mock.Call +} + +// Decimal is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) Decimal(column interface{}) *Blueprint_Decimal_Call { + return &Blueprint_Decimal_Call{Call: _e.mock.On("Decimal", column)} +} + +func (_c *Blueprint_Decimal_Call) Run(run func(column string)) *Blueprint_Decimal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_Decimal_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Decimal_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Decimal_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_Decimal_Call { + _c.Call.Return(run) + return _c +} + +// Double provides a mock function with given fields: column +func (_m *Blueprint) Double(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for Double") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Double_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Double' +type Blueprint_Double_Call struct { + *mock.Call +} + +// Double is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) Double(column interface{}) *Blueprint_Double_Call { + return &Blueprint_Double_Call{Call: _e.mock.On("Double", column)} +} + +func (_c *Blueprint_Double_Call) Run(run func(column string)) *Blueprint_Double_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_Double_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Double_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Double_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_Double_Call { + _c.Call.Return(run) + return _c +} + +// DropColumn provides a mock function with given fields: column +func (_m *Blueprint) DropColumn(column string) error { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for DropColumn") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(column) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Blueprint_DropColumn_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropColumn' +type Blueprint_DropColumn_Call struct { + *mock.Call +} + +// DropColumn is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) DropColumn(column interface{}) *Blueprint_DropColumn_Call { + return &Blueprint_DropColumn_Call{Call: _e.mock.On("DropColumn", column)} +} + +func (_c *Blueprint_DropColumn_Call) Run(run func(column string)) *Blueprint_DropColumn_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_DropColumn_Call) Return(_a0 error) *Blueprint_DropColumn_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_DropColumn_Call) RunAndReturn(run func(string) error) *Blueprint_DropColumn_Call { + _c.Call.Return(run) + return _c +} + +// DropForeign provides a mock function with given fields: index +func (_m *Blueprint) DropForeign(index string) error { + ret := _m.Called(index) + + if len(ret) == 0 { + panic("no return value specified for DropForeign") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(index) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Blueprint_DropForeign_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropForeign' +type Blueprint_DropForeign_Call struct { + *mock.Call +} + +// DropForeign is a helper method to define mock.On call +// - index string +func (_e *Blueprint_Expecter) DropForeign(index interface{}) *Blueprint_DropForeign_Call { + return &Blueprint_DropForeign_Call{Call: _e.mock.On("DropForeign", index)} +} + +func (_c *Blueprint_DropForeign_Call) Run(run func(index string)) *Blueprint_DropForeign_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_DropForeign_Call) Return(_a0 error) *Blueprint_DropForeign_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_DropForeign_Call) RunAndReturn(run func(string) error) *Blueprint_DropForeign_Call { + _c.Call.Return(run) + return _c +} + +// DropIndex provides a mock function with given fields: index +func (_m *Blueprint) DropIndex(index string) error { + ret := _m.Called(index) + + if len(ret) == 0 { + panic("no return value specified for DropIndex") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(index) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Blueprint_DropIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropIndex' +type Blueprint_DropIndex_Call struct { + *mock.Call +} + +// DropIndex is a helper method to define mock.On call +// - index string +func (_e *Blueprint_Expecter) DropIndex(index interface{}) *Blueprint_DropIndex_Call { + return &Blueprint_DropIndex_Call{Call: _e.mock.On("DropIndex", index)} +} + +func (_c *Blueprint_DropIndex_Call) Run(run func(index string)) *Blueprint_DropIndex_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_DropIndex_Call) Return(_a0 error) *Blueprint_DropIndex_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_DropIndex_Call) RunAndReturn(run func(string) error) *Blueprint_DropIndex_Call { + _c.Call.Return(run) + return _c +} + +// DropSoftDeletes provides a mock function with given fields: +func (_m *Blueprint) DropSoftDeletes() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for DropSoftDeletes") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Blueprint_DropSoftDeletes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropSoftDeletes' +type Blueprint_DropSoftDeletes_Call struct { + *mock.Call +} + +// DropSoftDeletes is a helper method to define mock.On call +func (_e *Blueprint_Expecter) DropSoftDeletes() *Blueprint_DropSoftDeletes_Call { + return &Blueprint_DropSoftDeletes_Call{Call: _e.mock.On("DropSoftDeletes")} +} + +func (_c *Blueprint_DropSoftDeletes_Call) Run(run func()) *Blueprint_DropSoftDeletes_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Blueprint_DropSoftDeletes_Call) Return(_a0 error) *Blueprint_DropSoftDeletes_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_DropSoftDeletes_Call) RunAndReturn(run func() error) *Blueprint_DropSoftDeletes_Call { + _c.Call.Return(run) + return _c +} + +// DropTimestamps provides a mock function with given fields: +func (_m *Blueprint) DropTimestamps() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for DropTimestamps") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Blueprint_DropTimestamps_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropTimestamps' +type Blueprint_DropTimestamps_Call struct { + *mock.Call +} + +// DropTimestamps is a helper method to define mock.On call +func (_e *Blueprint_Expecter) DropTimestamps() *Blueprint_DropTimestamps_Call { + return &Blueprint_DropTimestamps_Call{Call: _e.mock.On("DropTimestamps")} +} + +func (_c *Blueprint_DropTimestamps_Call) Run(run func()) *Blueprint_DropTimestamps_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Blueprint_DropTimestamps_Call) Return(_a0 error) *Blueprint_DropTimestamps_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_DropTimestamps_Call) RunAndReturn(run func() error) *Blueprint_DropTimestamps_Call { + _c.Call.Return(run) + return _c +} + +// Enum provides a mock function with given fields: column, array +func (_m *Blueprint) Enum(column string, array []interface{}) schema.ColumnDefinition { + ret := _m.Called(column, array) + + if len(ret) == 0 { + panic("no return value specified for Enum") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string, []interface{}) schema.ColumnDefinition); ok { + r0 = rf(column, array) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Enum_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Enum' +type Blueprint_Enum_Call struct { + *mock.Call +} + +// Enum is a helper method to define mock.On call +// - column string +// - array []interface{} +func (_e *Blueprint_Expecter) Enum(column interface{}, array interface{}) *Blueprint_Enum_Call { + return &Blueprint_Enum_Call{Call: _e.mock.On("Enum", column, array)} +} + +func (_c *Blueprint_Enum_Call) Run(run func(column string, array []interface{})) *Blueprint_Enum_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([]interface{})) + }) + return _c +} + +func (_c *Blueprint_Enum_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Enum_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Enum_Call) RunAndReturn(run func(string, []interface{}) schema.ColumnDefinition) *Blueprint_Enum_Call { + _c.Call.Return(run) + return _c +} + +// Float provides a mock function with given fields: column +func (_m *Blueprint) Float(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for Float") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Float_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Float' +type Blueprint_Float_Call struct { + *mock.Call +} + +// Float is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) Float(column interface{}) *Blueprint_Float_Call { + return &Blueprint_Float_Call{Call: _e.mock.On("Float", column)} +} + +func (_c *Blueprint_Float_Call) Run(run func(column string)) *Blueprint_Float_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_Float_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Float_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Float_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_Float_Call { + _c.Call.Return(run) + return _c +} + +// Foreign provides a mock function with given fields: columns, name +func (_m *Blueprint) Foreign(columns []string, name ...string) error { + _va := make([]interface{}, len(name)) + for _i := range name { + _va[_i] = name[_i] + } + var _ca []interface{} + _ca = append(_ca, columns) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for Foreign") + } + + var r0 error + if rf, ok := ret.Get(0).(func([]string, ...string) error); ok { + r0 = rf(columns, name...) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Blueprint_Foreign_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Foreign' +type Blueprint_Foreign_Call struct { + *mock.Call +} + +// Foreign is a helper method to define mock.On call +// - columns []string +// - name ...string +func (_e *Blueprint_Expecter) Foreign(columns interface{}, name ...interface{}) *Blueprint_Foreign_Call { + return &Blueprint_Foreign_Call{Call: _e.mock.On("Foreign", + append([]interface{}{columns}, name...)...)} +} + +func (_c *Blueprint_Foreign_Call) Run(run func(columns []string, name ...string)) *Blueprint_Foreign_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].([]string), variadicArgs...) + }) + return _c +} + +func (_c *Blueprint_Foreign_Call) Return(_a0 error) *Blueprint_Foreign_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Foreign_Call) RunAndReturn(run func([]string, ...string) error) *Blueprint_Foreign_Call { + _c.Call.Return(run) + return _c +} + +// GetAddedColumns provides a mock function with given fields: +func (_m *Blueprint) GetAddedColumns() []schema.ColumnDefinition { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetAddedColumns") + } + + var r0 []schema.ColumnDefinition + if rf, ok := ret.Get(0).(func() []schema.ColumnDefinition); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_GetAddedColumns_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAddedColumns' +type Blueprint_GetAddedColumns_Call struct { + *mock.Call +} + +// GetAddedColumns is a helper method to define mock.On call +func (_e *Blueprint_Expecter) GetAddedColumns() *Blueprint_GetAddedColumns_Call { + return &Blueprint_GetAddedColumns_Call{Call: _e.mock.On("GetAddedColumns")} +} + +func (_c *Blueprint_GetAddedColumns_Call) Run(run func()) *Blueprint_GetAddedColumns_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Blueprint_GetAddedColumns_Call) Return(_a0 []schema.ColumnDefinition) *Blueprint_GetAddedColumns_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_GetAddedColumns_Call) RunAndReturn(run func() []schema.ColumnDefinition) *Blueprint_GetAddedColumns_Call { + _c.Call.Return(run) + return _c +} + +// GetChangedColumns provides a mock function with given fields: +func (_m *Blueprint) GetChangedColumns() []schema.ColumnDefinition { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetChangedColumns") + } + + var r0 []schema.ColumnDefinition + if rf, ok := ret.Get(0).(func() []schema.ColumnDefinition); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_GetChangedColumns_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetChangedColumns' +type Blueprint_GetChangedColumns_Call struct { + *mock.Call +} + +// GetChangedColumns is a helper method to define mock.On call +func (_e *Blueprint_Expecter) GetChangedColumns() *Blueprint_GetChangedColumns_Call { + return &Blueprint_GetChangedColumns_Call{Call: _e.mock.On("GetChangedColumns")} +} + +func (_c *Blueprint_GetChangedColumns_Call) Run(run func()) *Blueprint_GetChangedColumns_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Blueprint_GetChangedColumns_Call) Return(_a0 []schema.ColumnDefinition) *Blueprint_GetChangedColumns_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_GetChangedColumns_Call) RunAndReturn(run func() []schema.ColumnDefinition) *Blueprint_GetChangedColumns_Call { + _c.Call.Return(run) + return _c +} + +// GetTableName provides a mock function with given fields: +func (_m *Blueprint) GetTableName() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetTableName") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Blueprint_GetTableName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTableName' +type Blueprint_GetTableName_Call struct { + *mock.Call +} + +// GetTableName is a helper method to define mock.On call +func (_e *Blueprint_Expecter) GetTableName() *Blueprint_GetTableName_Call { + return &Blueprint_GetTableName_Call{Call: _e.mock.On("GetTableName")} +} + +func (_c *Blueprint_GetTableName_Call) Run(run func()) *Blueprint_GetTableName_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Blueprint_GetTableName_Call) Return(_a0 string) *Blueprint_GetTableName_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_GetTableName_Call) RunAndReturn(run func() string) *Blueprint_GetTableName_Call { + _c.Call.Return(run) + return _c +} + +// ID provides a mock function with given fields: +func (_m *Blueprint) ID() schema.ColumnDefinition { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for ID") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func() schema.ColumnDefinition); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID' +type Blueprint_ID_Call struct { + *mock.Call +} + +// ID is a helper method to define mock.On call +func (_e *Blueprint_Expecter) ID() *Blueprint_ID_Call { + return &Blueprint_ID_Call{Call: _e.mock.On("ID")} +} + +func (_c *Blueprint_ID_Call) Run(run func()) *Blueprint_ID_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Blueprint_ID_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_ID_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_ID_Call) RunAndReturn(run func() schema.ColumnDefinition) *Blueprint_ID_Call { + _c.Call.Return(run) + return _c +} + +// Index provides a mock function with given fields: columns, name +func (_m *Blueprint) Index(columns []string, name string) error { + ret := _m.Called(columns, name) + + if len(ret) == 0 { + panic("no return value specified for Index") + } + + var r0 error + if rf, ok := ret.Get(0).(func([]string, string) error); ok { + r0 = rf(columns, name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Blueprint_Index_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Index' +type Blueprint_Index_Call struct { + *mock.Call +} + +// Index is a helper method to define mock.On call +// - columns []string +// - name string +func (_e *Blueprint_Expecter) Index(columns interface{}, name interface{}) *Blueprint_Index_Call { + return &Blueprint_Index_Call{Call: _e.mock.On("Index", columns, name)} +} + +func (_c *Blueprint_Index_Call) Run(run func(columns []string, name string)) *Blueprint_Index_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]string), args[1].(string)) + }) + return _c +} + +func (_c *Blueprint_Index_Call) Return(_a0 error) *Blueprint_Index_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Index_Call) RunAndReturn(run func([]string, string) error) *Blueprint_Index_Call { + _c.Call.Return(run) + return _c +} + +// Integer provides a mock function with given fields: column +func (_m *Blueprint) Integer(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for Integer") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Integer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Integer' +type Blueprint_Integer_Call struct { + *mock.Call +} + +// Integer is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) Integer(column interface{}) *Blueprint_Integer_Call { + return &Blueprint_Integer_Call{Call: _e.mock.On("Integer", column)} +} + +func (_c *Blueprint_Integer_Call) Run(run func(column string)) *Blueprint_Integer_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_Integer_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Integer_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Integer_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_Integer_Call { + _c.Call.Return(run) + return _c +} + +// Json provides a mock function with given fields: column +func (_m *Blueprint) Json(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for Json") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Json_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Json' +type Blueprint_Json_Call struct { + *mock.Call +} + +// Json is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) Json(column interface{}) *Blueprint_Json_Call { + return &Blueprint_Json_Call{Call: _e.mock.On("Json", column)} +} + +func (_c *Blueprint_Json_Call) Run(run func(column string)) *Blueprint_Json_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_Json_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Json_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Json_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_Json_Call { + _c.Call.Return(run) + return _c +} + +// Jsonb provides a mock function with given fields: column +func (_m *Blueprint) Jsonb(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for Jsonb") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Jsonb_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Jsonb' +type Blueprint_Jsonb_Call struct { + *mock.Call +} + +// Jsonb is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) Jsonb(column interface{}) *Blueprint_Jsonb_Call { + return &Blueprint_Jsonb_Call{Call: _e.mock.On("Jsonb", column)} +} + +func (_c *Blueprint_Jsonb_Call) Run(run func(column string)) *Blueprint_Jsonb_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_Jsonb_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Jsonb_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Jsonb_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_Jsonb_Call { + _c.Call.Return(run) + return _c +} + +// Primary provides a mock function with given fields: columns, name +func (_m *Blueprint) Primary(columns []string, name string) error { + ret := _m.Called(columns, name) + + if len(ret) == 0 { + panic("no return value specified for Primary") + } + + var r0 error + if rf, ok := ret.Get(0).(func([]string, string) error); ok { + r0 = rf(columns, name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Blueprint_Primary_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Primary' +type Blueprint_Primary_Call struct { + *mock.Call +} + +// Primary is a helper method to define mock.On call +// - columns []string +// - name string +func (_e *Blueprint_Expecter) Primary(columns interface{}, name interface{}) *Blueprint_Primary_Call { + return &Blueprint_Primary_Call{Call: _e.mock.On("Primary", columns, name)} +} + +func (_c *Blueprint_Primary_Call) Run(run func(columns []string, name string)) *Blueprint_Primary_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]string), args[1].(string)) + }) + return _c +} + +func (_c *Blueprint_Primary_Call) Return(_a0 error) *Blueprint_Primary_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Primary_Call) RunAndReturn(run func([]string, string) error) *Blueprint_Primary_Call { + _c.Call.Return(run) + return _c +} + +// RenameColumn provides a mock function with given fields: from, to +func (_m *Blueprint) RenameColumn(from string, to string) error { + ret := _m.Called(from, to) + + if len(ret) == 0 { + panic("no return value specified for RenameColumn") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(from, to) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Blueprint_RenameColumn_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RenameColumn' +type Blueprint_RenameColumn_Call struct { + *mock.Call +} + +// RenameColumn is a helper method to define mock.On call +// - from string +// - to string +func (_e *Blueprint_Expecter) RenameColumn(from interface{}, to interface{}) *Blueprint_RenameColumn_Call { + return &Blueprint_RenameColumn_Call{Call: _e.mock.On("RenameColumn", from, to)} +} + +func (_c *Blueprint_RenameColumn_Call) Run(run func(from string, to string)) *Blueprint_RenameColumn_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Blueprint_RenameColumn_Call) Return(_a0 error) *Blueprint_RenameColumn_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_RenameColumn_Call) RunAndReturn(run func(string, string) error) *Blueprint_RenameColumn_Call { + _c.Call.Return(run) + return _c +} + +// RenameIndex provides a mock function with given fields: from, to +func (_m *Blueprint) RenameIndex(from string, to string) error { + ret := _m.Called(from, to) + + if len(ret) == 0 { + panic("no return value specified for RenameIndex") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(from, to) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Blueprint_RenameIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RenameIndex' +type Blueprint_RenameIndex_Call struct { + *mock.Call +} + +// RenameIndex is a helper method to define mock.On call +// - from string +// - to string +func (_e *Blueprint_Expecter) RenameIndex(from interface{}, to interface{}) *Blueprint_RenameIndex_Call { + return &Blueprint_RenameIndex_Call{Call: _e.mock.On("RenameIndex", from, to)} +} + +func (_c *Blueprint_RenameIndex_Call) Run(run func(from string, to string)) *Blueprint_RenameIndex_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Blueprint_RenameIndex_Call) Return(_a0 error) *Blueprint_RenameIndex_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_RenameIndex_Call) RunAndReturn(run func(string, string) error) *Blueprint_RenameIndex_Call { + _c.Call.Return(run) + return _c +} + +// SoftDeletes provides a mock function with given fields: column +func (_m *Blueprint) SoftDeletes(column ...string) schema.ColumnDefinition { + _va := make([]interface{}, len(column)) + for _i := range column { + _va[_i] = column[_i] + } + var _ca []interface{} + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for SoftDeletes") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(...string) schema.ColumnDefinition); ok { + r0 = rf(column...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_SoftDeletes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SoftDeletes' +type Blueprint_SoftDeletes_Call struct { + *mock.Call +} + +// SoftDeletes is a helper method to define mock.On call +// - column ...string +func (_e *Blueprint_Expecter) SoftDeletes(column ...interface{}) *Blueprint_SoftDeletes_Call { + return &Blueprint_SoftDeletes_Call{Call: _e.mock.On("SoftDeletes", + append([]interface{}{}, column...)...)} +} + +func (_c *Blueprint_SoftDeletes_Call) Run(run func(column ...string)) *Blueprint_SoftDeletes_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *Blueprint_SoftDeletes_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_SoftDeletes_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_SoftDeletes_Call) RunAndReturn(run func(...string) schema.ColumnDefinition) *Blueprint_SoftDeletes_Call { + _c.Call.Return(run) + return _c +} + +// SoftDeletesTz provides a mock function with given fields: column +func (_m *Blueprint) SoftDeletesTz(column ...string) schema.ColumnDefinition { + _va := make([]interface{}, len(column)) + for _i := range column { + _va[_i] = column[_i] + } + var _ca []interface{} + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for SoftDeletesTz") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(...string) schema.ColumnDefinition); ok { + r0 = rf(column...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_SoftDeletesTz_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SoftDeletesTz' +type Blueprint_SoftDeletesTz_Call struct { + *mock.Call +} + +// SoftDeletesTz is a helper method to define mock.On call +// - column ...string +func (_e *Blueprint_Expecter) SoftDeletesTz(column ...interface{}) *Blueprint_SoftDeletesTz_Call { + return &Blueprint_SoftDeletesTz_Call{Call: _e.mock.On("SoftDeletesTz", + append([]interface{}{}, column...)...)} +} + +func (_c *Blueprint_SoftDeletesTz_Call) Run(run func(column ...string)) *Blueprint_SoftDeletesTz_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *Blueprint_SoftDeletesTz_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_SoftDeletesTz_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_SoftDeletesTz_Call) RunAndReturn(run func(...string) schema.ColumnDefinition) *Blueprint_SoftDeletesTz_Call { + _c.Call.Return(run) + return _c +} + +// String provides a mock function with given fields: column, length +func (_m *Blueprint) String(column string, length ...int) schema.ColumnDefinition { + _va := make([]interface{}, len(length)) + for _i := range length { + _va[_i] = length[_i] + } + var _ca []interface{} + _ca = append(_ca, column) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for String") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string, ...int) schema.ColumnDefinition); ok { + r0 = rf(column, length...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_String_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'String' +type Blueprint_String_Call struct { + *mock.Call +} + +// String is a helper method to define mock.On call +// - column string +// - length ...int +func (_e *Blueprint_Expecter) String(column interface{}, length ...interface{}) *Blueprint_String_Call { + return &Blueprint_String_Call{Call: _e.mock.On("String", + append([]interface{}{column}, length...)...)} +} + +func (_c *Blueprint_String_Call) Run(run func(column string, length ...int)) *Blueprint_String_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]int, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(int) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *Blueprint_String_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_String_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_String_Call) RunAndReturn(run func(string, ...int) schema.ColumnDefinition) *Blueprint_String_Call { + _c.Call.Return(run) + return _c +} + +// Text provides a mock function with given fields: column +func (_m *Blueprint) Text(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for Text") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Text_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Text' +type Blueprint_Text_Call struct { + *mock.Call +} + +// Text is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) Text(column interface{}) *Blueprint_Text_Call { + return &Blueprint_Text_Call{Call: _e.mock.On("Text", column)} +} + +func (_c *Blueprint_Text_Call) Run(run func(column string)) *Blueprint_Text_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_Text_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Text_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Text_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_Text_Call { + _c.Call.Return(run) + return _c +} + +// Time provides a mock function with given fields: column +func (_m *Blueprint) Time(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for Time") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Time_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Time' +type Blueprint_Time_Call struct { + *mock.Call +} + +// Time is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) Time(column interface{}) *Blueprint_Time_Call { + return &Blueprint_Time_Call{Call: _e.mock.On("Time", column)} +} + +func (_c *Blueprint_Time_Call) Run(run func(column string)) *Blueprint_Time_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_Time_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Time_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Time_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_Time_Call { + _c.Call.Return(run) + return _c +} + +// TimeTz provides a mock function with given fields: column +func (_m *Blueprint) TimeTz(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TimeTz") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_TimeTz_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TimeTz' +type Blueprint_TimeTz_Call struct { + *mock.Call +} + +// TimeTz is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) TimeTz(column interface{}) *Blueprint_TimeTz_Call { + return &Blueprint_TimeTz_Call{Call: _e.mock.On("TimeTz", column)} +} + +func (_c *Blueprint_TimeTz_Call) Run(run func(column string)) *Blueprint_TimeTz_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_TimeTz_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_TimeTz_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_TimeTz_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_TimeTz_Call { + _c.Call.Return(run) + return _c +} + +// Timestamp provides a mock function with given fields: column +func (_m *Blueprint) Timestamp(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for Timestamp") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Timestamp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Timestamp' +type Blueprint_Timestamp_Call struct { + *mock.Call +} + +// Timestamp is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) Timestamp(column interface{}) *Blueprint_Timestamp_Call { + return &Blueprint_Timestamp_Call{Call: _e.mock.On("Timestamp", column)} +} + +func (_c *Blueprint_Timestamp_Call) Run(run func(column string)) *Blueprint_Timestamp_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_Timestamp_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Timestamp_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Timestamp_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_Timestamp_Call { + _c.Call.Return(run) + return _c +} + +// TimestampTz provides a mock function with given fields: column +func (_m *Blueprint) TimestampTz(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TimestampTz") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_TimestampTz_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TimestampTz' +type Blueprint_TimestampTz_Call struct { + *mock.Call +} + +// TimestampTz is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) TimestampTz(column interface{}) *Blueprint_TimestampTz_Call { + return &Blueprint_TimestampTz_Call{Call: _e.mock.On("TimestampTz", column)} +} + +func (_c *Blueprint_TimestampTz_Call) Run(run func(column string)) *Blueprint_TimestampTz_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_TimestampTz_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_TimestampTz_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_TimestampTz_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_TimestampTz_Call { + _c.Call.Return(run) + return _c +} + +// Timestamps provides a mock function with given fields: +func (_m *Blueprint) Timestamps() schema.ColumnDefinition { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Timestamps") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func() schema.ColumnDefinition); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_Timestamps_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Timestamps' +type Blueprint_Timestamps_Call struct { + *mock.Call +} + +// Timestamps is a helper method to define mock.On call +func (_e *Blueprint_Expecter) Timestamps() *Blueprint_Timestamps_Call { + return &Blueprint_Timestamps_Call{Call: _e.mock.On("Timestamps")} +} + +func (_c *Blueprint_Timestamps_Call) Run(run func()) *Blueprint_Timestamps_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Blueprint_Timestamps_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_Timestamps_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Timestamps_Call) RunAndReturn(run func() schema.ColumnDefinition) *Blueprint_Timestamps_Call { + _c.Call.Return(run) + return _c +} + +// TimestampsTz provides a mock function with given fields: +func (_m *Blueprint) TimestampsTz() schema.ColumnDefinition { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for TimestampsTz") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func() schema.ColumnDefinition); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_TimestampsTz_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TimestampsTz' +type Blueprint_TimestampsTz_Call struct { + *mock.Call +} + +// TimestampsTz is a helper method to define mock.On call +func (_e *Blueprint_Expecter) TimestampsTz() *Blueprint_TimestampsTz_Call { + return &Blueprint_TimestampsTz_Call{Call: _e.mock.On("TimestampsTz")} +} + +func (_c *Blueprint_TimestampsTz_Call) Run(run func()) *Blueprint_TimestampsTz_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Blueprint_TimestampsTz_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_TimestampsTz_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_TimestampsTz_Call) RunAndReturn(run func() schema.ColumnDefinition) *Blueprint_TimestampsTz_Call { + _c.Call.Return(run) + return _c +} + +// ToSql provides a mock function with given fields: query, grammar +func (_m *Blueprint) ToSql(query orm.Query, grammar schema.Grammar) []string { + ret := _m.Called(query, grammar) + + if len(ret) == 0 { + panic("no return value specified for ToSql") + } + + var r0 []string + if rf, ok := ret.Get(0).(func(orm.Query, schema.Grammar) []string); ok { + r0 = rf(query, grammar) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + return r0 +} + +// Blueprint_ToSql_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ToSql' +type Blueprint_ToSql_Call struct { + *mock.Call +} + +// ToSql is a helper method to define mock.On call +// - query orm.Query +// - grammar schema.Grammar +func (_e *Blueprint_Expecter) ToSql(query interface{}, grammar interface{}) *Blueprint_ToSql_Call { + return &Blueprint_ToSql_Call{Call: _e.mock.On("ToSql", query, grammar)} +} + +func (_c *Blueprint_ToSql_Call) Run(run func(query orm.Query, grammar schema.Grammar)) *Blueprint_ToSql_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(orm.Query), args[1].(schema.Grammar)) + }) + return _c +} + +func (_c *Blueprint_ToSql_Call) Return(_a0 []string) *Blueprint_ToSql_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_ToSql_Call) RunAndReturn(run func(orm.Query, schema.Grammar) []string) *Blueprint_ToSql_Call { + _c.Call.Return(run) + return _c +} + +// Unique provides a mock function with given fields: columns, name +func (_m *Blueprint) Unique(columns []string, name string) error { + ret := _m.Called(columns, name) + + if len(ret) == 0 { + panic("no return value specified for Unique") + } + + var r0 error + if rf, ok := ret.Get(0).(func([]string, string) error); ok { + r0 = rf(columns, name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Blueprint_Unique_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Unique' +type Blueprint_Unique_Call struct { + *mock.Call +} + +// Unique is a helper method to define mock.On call +// - columns []string +// - name string +func (_e *Blueprint_Expecter) Unique(columns interface{}, name interface{}) *Blueprint_Unique_Call { + return &Blueprint_Unique_Call{Call: _e.mock.On("Unique", columns, name)} +} + +func (_c *Blueprint_Unique_Call) Run(run func(columns []string, name string)) *Blueprint_Unique_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]string), args[1].(string)) + }) + return _c +} + +func (_c *Blueprint_Unique_Call) Return(_a0 error) *Blueprint_Unique_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_Unique_Call) RunAndReturn(run func([]string, string) error) *Blueprint_Unique_Call { + _c.Call.Return(run) + return _c +} + +// UnsignedBigInteger provides a mock function with given fields: column +func (_m *Blueprint) UnsignedBigInteger(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for UnsignedBigInteger") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_UnsignedBigInteger_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnsignedBigInteger' +type Blueprint_UnsignedBigInteger_Call struct { + *mock.Call +} + +// UnsignedBigInteger is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) UnsignedBigInteger(column interface{}) *Blueprint_UnsignedBigInteger_Call { + return &Blueprint_UnsignedBigInteger_Call{Call: _e.mock.On("UnsignedBigInteger", column)} +} + +func (_c *Blueprint_UnsignedBigInteger_Call) Run(run func(column string)) *Blueprint_UnsignedBigInteger_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_UnsignedBigInteger_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_UnsignedBigInteger_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_UnsignedBigInteger_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_UnsignedBigInteger_Call { + _c.Call.Return(run) + return _c +} + +// UnsignedInteger provides a mock function with given fields: column +func (_m *Blueprint) UnsignedInteger(column string) schema.ColumnDefinition { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for UnsignedInteger") + } + + var r0 schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) schema.ColumnDefinition); ok { + r0 = rf(column) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.ColumnDefinition) + } + } + + return r0 +} + +// Blueprint_UnsignedInteger_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnsignedInteger' +type Blueprint_UnsignedInteger_Call struct { + *mock.Call +} + +// UnsignedInteger is a helper method to define mock.On call +// - column string +func (_e *Blueprint_Expecter) UnsignedInteger(column interface{}) *Blueprint_UnsignedInteger_Call { + return &Blueprint_UnsignedInteger_Call{Call: _e.mock.On("UnsignedInteger", column)} +} + +func (_c *Blueprint_UnsignedInteger_Call) Run(run func(column string)) *Blueprint_UnsignedInteger_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Blueprint_UnsignedInteger_Call) Return(_a0 schema.ColumnDefinition) *Blueprint_UnsignedInteger_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Blueprint_UnsignedInteger_Call) RunAndReturn(run func(string) schema.ColumnDefinition) *Blueprint_UnsignedInteger_Call { + _c.Call.Return(run) + return _c +} + +// NewBlueprint creates a new instance of Blueprint. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewBlueprint(t interface { + mock.TestingT + Cleanup(func()) +}) *Blueprint { + mock := &Blueprint{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/database/schema/Column.go b/mocks/database/schema/Column.go new file mode 100644 index 000000000..7a241e799 --- /dev/null +++ b/mocks/database/schema/Column.go @@ -0,0 +1,426 @@ +// Code generated by mockery v2.39.1. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" + +// Column is an autogenerated mock type for the Column type +type Column struct { + mock.Mock +} + +type Column_Expecter struct { + mock *mock.Mock +} + +func (_m *Column) EXPECT() *Column_Expecter { + return &Column_Expecter{mock: &_m.Mock} +} + +// Change provides a mock function with given fields: +func (_m *Column) Change() { + _m.Called() +} + +// Column_Change_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Change' +type Column_Change_Call struct { + *mock.Call +} + +// Change is a helper method to define mock.On call +func (_e *Column_Expecter) Change() *Column_Change_Call { + return &Column_Change_Call{Call: _e.mock.On("Change")} +} + +func (_c *Column_Change_Call) Run(run func()) *Column_Change_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Column_Change_Call) Return() *Column_Change_Call { + _c.Call.Return() + return _c +} + +func (_c *Column_Change_Call) RunAndReturn(run func()) *Column_Change_Call { + _c.Call.Return(run) + return _c +} + +// GetAllowed provides a mock function with given fields: +func (_m *Column) GetAllowed() []string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetAllowed") + } + + var r0 []string + if rf, ok := ret.Get(0).(func() []string); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + return r0 +} + +// Column_GetAllowed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllowed' +type Column_GetAllowed_Call struct { + *mock.Call +} + +// GetAllowed is a helper method to define mock.On call +func (_e *Column_Expecter) GetAllowed() *Column_GetAllowed_Call { + return &Column_GetAllowed_Call{Call: _e.mock.On("GetAllowed")} +} + +func (_c *Column_GetAllowed_Call) Run(run func()) *Column_GetAllowed_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Column_GetAllowed_Call) Return(_a0 []string) *Column_GetAllowed_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Column_GetAllowed_Call) RunAndReturn(run func() []string) *Column_GetAllowed_Call { + _c.Call.Return(run) + return _c +} + +// GetAutoIncrement provides a mock function with given fields: +func (_m *Column) GetAutoIncrement() bool { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetAutoIncrement") + } + + var r0 bool + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// Column_GetAutoIncrement_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAutoIncrement' +type Column_GetAutoIncrement_Call struct { + *mock.Call +} + +// GetAutoIncrement is a helper method to define mock.On call +func (_e *Column_Expecter) GetAutoIncrement() *Column_GetAutoIncrement_Call { + return &Column_GetAutoIncrement_Call{Call: _e.mock.On("GetAutoIncrement")} +} + +func (_c *Column_GetAutoIncrement_Call) Run(run func()) *Column_GetAutoIncrement_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Column_GetAutoIncrement_Call) Return(_a0 bool) *Column_GetAutoIncrement_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Column_GetAutoIncrement_Call) RunAndReturn(run func() bool) *Column_GetAutoIncrement_Call { + _c.Call.Return(run) + return _c +} + +// GetLength provides a mock function with given fields: +func (_m *Column) GetLength() int { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetLength") + } + + var r0 int + if rf, ok := ret.Get(0).(func() int); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(int) + } + + return r0 +} + +// Column_GetLength_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLength' +type Column_GetLength_Call struct { + *mock.Call +} + +// GetLength is a helper method to define mock.On call +func (_e *Column_Expecter) GetLength() *Column_GetLength_Call { + return &Column_GetLength_Call{Call: _e.mock.On("GetLength")} +} + +func (_c *Column_GetLength_Call) Run(run func()) *Column_GetLength_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Column_GetLength_Call) Return(_a0 int) *Column_GetLength_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Column_GetLength_Call) RunAndReturn(run func() int) *Column_GetLength_Call { + _c.Call.Return(run) + return _c +} + +// GetName provides a mock function with given fields: +func (_m *Column) GetName() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetName") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Column_GetName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetName' +type Column_GetName_Call struct { + *mock.Call +} + +// GetName is a helper method to define mock.On call +func (_e *Column_Expecter) GetName() *Column_GetName_Call { + return &Column_GetName_Call{Call: _e.mock.On("GetName")} +} + +func (_c *Column_GetName_Call) Run(run func()) *Column_GetName_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Column_GetName_Call) Return(_a0 string) *Column_GetName_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Column_GetName_Call) RunAndReturn(run func() string) *Column_GetName_Call { + _c.Call.Return(run) + return _c +} + +// GetPlaces provides a mock function with given fields: +func (_m *Column) GetPlaces() int { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetPlaces") + } + + var r0 int + if rf, ok := ret.Get(0).(func() int); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(int) + } + + return r0 +} + +// Column_GetPlaces_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPlaces' +type Column_GetPlaces_Call struct { + *mock.Call +} + +// GetPlaces is a helper method to define mock.On call +func (_e *Column_Expecter) GetPlaces() *Column_GetPlaces_Call { + return &Column_GetPlaces_Call{Call: _e.mock.On("GetPlaces")} +} + +func (_c *Column_GetPlaces_Call) Run(run func()) *Column_GetPlaces_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Column_GetPlaces_Call) Return(_a0 int) *Column_GetPlaces_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Column_GetPlaces_Call) RunAndReturn(run func() int) *Column_GetPlaces_Call { + _c.Call.Return(run) + return _c +} + +// GetPrecision provides a mock function with given fields: +func (_m *Column) GetPrecision() int { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetPrecision") + } + + var r0 int + if rf, ok := ret.Get(0).(func() int); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(int) + } + + return r0 +} + +// Column_GetPrecision_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPrecision' +type Column_GetPrecision_Call struct { + *mock.Call +} + +// GetPrecision is a helper method to define mock.On call +func (_e *Column_Expecter) GetPrecision() *Column_GetPrecision_Call { + return &Column_GetPrecision_Call{Call: _e.mock.On("GetPrecision")} +} + +func (_c *Column_GetPrecision_Call) Run(run func()) *Column_GetPrecision_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Column_GetPrecision_Call) Return(_a0 int) *Column_GetPrecision_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Column_GetPrecision_Call) RunAndReturn(run func() int) *Column_GetPrecision_Call { + _c.Call.Return(run) + return _c +} + +// GetTotal provides a mock function with given fields: +func (_m *Column) GetTotal() int { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetTotal") + } + + var r0 int + if rf, ok := ret.Get(0).(func() int); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(int) + } + + return r0 +} + +// Column_GetTotal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTotal' +type Column_GetTotal_Call struct { + *mock.Call +} + +// GetTotal is a helper method to define mock.On call +func (_e *Column_Expecter) GetTotal() *Column_GetTotal_Call { + return &Column_GetTotal_Call{Call: _e.mock.On("GetTotal")} +} + +func (_c *Column_GetTotal_Call) Run(run func()) *Column_GetTotal_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Column_GetTotal_Call) Return(_a0 int) *Column_GetTotal_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Column_GetTotal_Call) RunAndReturn(run func() int) *Column_GetTotal_Call { + _c.Call.Return(run) + return _c +} + +// GetType provides a mock function with given fields: +func (_m *Column) GetType() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetType") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Column_GetType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetType' +type Column_GetType_Call struct { + *mock.Call +} + +// GetType is a helper method to define mock.On call +func (_e *Column_Expecter) GetType() *Column_GetType_Call { + return &Column_GetType_Call{Call: _e.mock.On("GetType")} +} + +func (_c *Column_GetType_Call) Run(run func()) *Column_GetType_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Column_GetType_Call) Return(_a0 string) *Column_GetType_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Column_GetType_Call) RunAndReturn(run func() string) *Column_GetType_Call { + _c.Call.Return(run) + return _c +} + +// NewColumn creates a new instance of Column. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewColumn(t interface { + mock.TestingT + Cleanup(func()) +}) *Column { + mock := &Column{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/database/schema/Grammar.go b/mocks/database/schema/Grammar.go new file mode 100644 index 000000000..67cea6f87 --- /dev/null +++ b/mocks/database/schema/Grammar.go @@ -0,0 +1,2273 @@ +// Code generated by mockery v2.39.1. DO NOT EDIT. + +package mocks + +import ( + orm "github.com/goravel/framework/contracts/database/orm" + schema "github.com/goravel/framework/contracts/database/schema" + mock "github.com/stretchr/testify/mock" +) + +// Grammar is an autogenerated mock type for the Grammar type +type Grammar struct { + mock.Mock +} + +type Grammar_Expecter struct { + mock *mock.Mock +} + +func (_m *Grammar) EXPECT() *Grammar_Expecter { + return &Grammar_Expecter{mock: &_m.Mock} +} + +// CompileAdd provides a mock function with given fields: blueprint, command +func (_m *Grammar) CompileAdd(blueprint schema.Blueprint, command string) string { + ret := _m.Called(blueprint, command) + + if len(ret) == 0 { + panic("no return value specified for CompileAdd") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, command) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileAdd_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileAdd' +type Grammar_CompileAdd_Call struct { + *mock.Call +} + +// CompileAdd is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +func (_e *Grammar_Expecter) CompileAdd(blueprint interface{}, command interface{}) *Grammar_CompileAdd_Call { + return &Grammar_CompileAdd_Call{Call: _e.mock.On("CompileAdd", blueprint, command)} +} + +func (_c *Grammar_CompileAdd_Call) Run(run func(blueprint schema.Blueprint, command string)) *Grammar_CompileAdd_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileAdd_Call) Return(_a0 string) *Grammar_CompileAdd_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileAdd_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_CompileAdd_Call { + _c.Call.Return(run) + return _c +} + +// CompileAutoIncrementStartingValues provides a mock function with given fields: blueprint, command +func (_m *Grammar) CompileAutoIncrementStartingValues(blueprint schema.Blueprint, command string) string { + ret := _m.Called(blueprint, command) + + if len(ret) == 0 { + panic("no return value specified for CompileAutoIncrementStartingValues") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, command) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileAutoIncrementStartingValues_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileAutoIncrementStartingValues' +type Grammar_CompileAutoIncrementStartingValues_Call struct { + *mock.Call +} + +// CompileAutoIncrementStartingValues is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +func (_e *Grammar_Expecter) CompileAutoIncrementStartingValues(blueprint interface{}, command interface{}) *Grammar_CompileAutoIncrementStartingValues_Call { + return &Grammar_CompileAutoIncrementStartingValues_Call{Call: _e.mock.On("CompileAutoIncrementStartingValues", blueprint, command)} +} + +func (_c *Grammar_CompileAutoIncrementStartingValues_Call) Run(run func(blueprint schema.Blueprint, command string)) *Grammar_CompileAutoIncrementStartingValues_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileAutoIncrementStartingValues_Call) Return(_a0 string) *Grammar_CompileAutoIncrementStartingValues_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileAutoIncrementStartingValues_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_CompileAutoIncrementStartingValues_Call { + _c.Call.Return(run) + return _c +} + +// CompileChange provides a mock function with given fields: blueprint, command, connection +func (_m *Grammar) CompileChange(blueprint schema.Blueprint, command string, connection string) string { + ret := _m.Called(blueprint, command, connection) + + if len(ret) == 0 { + panic("no return value specified for CompileChange") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string, string) string); ok { + r0 = rf(blueprint, command, connection) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileChange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileChange' +type Grammar_CompileChange_Call struct { + *mock.Call +} + +// CompileChange is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +// - connection string +func (_e *Grammar_Expecter) CompileChange(blueprint interface{}, command interface{}, connection interface{}) *Grammar_CompileChange_Call { + return &Grammar_CompileChange_Call{Call: _e.mock.On("CompileChange", blueprint, command, connection)} +} + +func (_c *Grammar_CompileChange_Call) Run(run func(blueprint schema.Blueprint, command string, connection string)) *Grammar_CompileChange_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *Grammar_CompileChange_Call) Return(_a0 string) *Grammar_CompileChange_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileChange_Call) RunAndReturn(run func(schema.Blueprint, string, string) string) *Grammar_CompileChange_Call { + _c.Call.Return(run) + return _c +} + +// CompileColumns provides a mock function with given fields: database, table +func (_m *Grammar) CompileColumns(database string, table string) string { + ret := _m.Called(database, table) + + if len(ret) == 0 { + panic("no return value specified for CompileColumns") + } + + var r0 string + if rf, ok := ret.Get(0).(func(string, string) string); ok { + r0 = rf(database, table) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileColumns_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileColumns' +type Grammar_CompileColumns_Call struct { + *mock.Call +} + +// CompileColumns is a helper method to define mock.On call +// - database string +// - table string +func (_e *Grammar_Expecter) CompileColumns(database interface{}, table interface{}) *Grammar_CompileColumns_Call { + return &Grammar_CompileColumns_Call{Call: _e.mock.On("CompileColumns", database, table)} +} + +func (_c *Grammar_CompileColumns_Call) Run(run func(database string, table string)) *Grammar_CompileColumns_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileColumns_Call) Return(_a0 string) *Grammar_CompileColumns_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileColumns_Call) RunAndReturn(run func(string, string) string) *Grammar_CompileColumns_Call { + _c.Call.Return(run) + return _c +} + +// CompileCreate provides a mock function with given fields: blueprint, query +func (_m *Grammar) CompileCreate(blueprint schema.Blueprint, query orm.Query) string { + ret := _m.Called(blueprint, query) + + if len(ret) == 0 { + panic("no return value specified for CompileCreate") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, orm.Query) string); ok { + r0 = rf(blueprint, query) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileCreate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileCreate' +type Grammar_CompileCreate_Call struct { + *mock.Call +} + +// CompileCreate is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - query orm.Query +func (_e *Grammar_Expecter) CompileCreate(blueprint interface{}, query interface{}) *Grammar_CompileCreate_Call { + return &Grammar_CompileCreate_Call{Call: _e.mock.On("CompileCreate", blueprint, query)} +} + +func (_c *Grammar_CompileCreate_Call) Run(run func(blueprint schema.Blueprint, query orm.Query)) *Grammar_CompileCreate_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(orm.Query)) + }) + return _c +} + +func (_c *Grammar_CompileCreate_Call) Return(_a0 string) *Grammar_CompileCreate_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileCreate_Call) RunAndReturn(run func(schema.Blueprint, orm.Query) string) *Grammar_CompileCreate_Call { + _c.Call.Return(run) + return _c +} + +// CompileCreateEncoding provides a mock function with given fields: sql, connection, blueprint +func (_m *Grammar) CompileCreateEncoding(sql string, connection string, blueprint schema.Blueprint) string { + ret := _m.Called(sql, connection, blueprint) + + if len(ret) == 0 { + panic("no return value specified for CompileCreateEncoding") + } + + var r0 string + if rf, ok := ret.Get(0).(func(string, string, schema.Blueprint) string); ok { + r0 = rf(sql, connection, blueprint) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileCreateEncoding_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileCreateEncoding' +type Grammar_CompileCreateEncoding_Call struct { + *mock.Call +} + +// CompileCreateEncoding is a helper method to define mock.On call +// - sql string +// - connection string +// - blueprint schema.Blueprint +func (_e *Grammar_Expecter) CompileCreateEncoding(sql interface{}, connection interface{}, blueprint interface{}) *Grammar_CompileCreateEncoding_Call { + return &Grammar_CompileCreateEncoding_Call{Call: _e.mock.On("CompileCreateEncoding", sql, connection, blueprint)} +} + +func (_c *Grammar_CompileCreateEncoding_Call) Run(run func(sql string, connection string, blueprint schema.Blueprint)) *Grammar_CompileCreateEncoding_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(schema.Blueprint)) + }) + return _c +} + +func (_c *Grammar_CompileCreateEncoding_Call) Return(_a0 string) *Grammar_CompileCreateEncoding_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileCreateEncoding_Call) RunAndReturn(run func(string, string, schema.Blueprint) string) *Grammar_CompileCreateEncoding_Call { + _c.Call.Return(run) + return _c +} + +// CompileCreateEngine provides a mock function with given fields: sql, connection, blueprint +func (_m *Grammar) CompileCreateEngine(sql string, connection string, blueprint schema.Blueprint) string { + ret := _m.Called(sql, connection, blueprint) + + if len(ret) == 0 { + panic("no return value specified for CompileCreateEngine") + } + + var r0 string + if rf, ok := ret.Get(0).(func(string, string, schema.Blueprint) string); ok { + r0 = rf(sql, connection, blueprint) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileCreateEngine_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileCreateEngine' +type Grammar_CompileCreateEngine_Call struct { + *mock.Call +} + +// CompileCreateEngine is a helper method to define mock.On call +// - sql string +// - connection string +// - blueprint schema.Blueprint +func (_e *Grammar_Expecter) CompileCreateEngine(sql interface{}, connection interface{}, blueprint interface{}) *Grammar_CompileCreateEngine_Call { + return &Grammar_CompileCreateEngine_Call{Call: _e.mock.On("CompileCreateEngine", sql, connection, blueprint)} +} + +func (_c *Grammar_CompileCreateEngine_Call) Run(run func(sql string, connection string, blueprint schema.Blueprint)) *Grammar_CompileCreateEngine_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(schema.Blueprint)) + }) + return _c +} + +func (_c *Grammar_CompileCreateEngine_Call) Return(_a0 string) *Grammar_CompileCreateEngine_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileCreateEngine_Call) RunAndReturn(run func(string, string, schema.Blueprint) string) *Grammar_CompileCreateEngine_Call { + _c.Call.Return(run) + return _c +} + +// CompileCreateTable provides a mock function with given fields: blueprint, command, connection +func (_m *Grammar) CompileCreateTable(blueprint schema.Blueprint, command string, connection string) string { + ret := _m.Called(blueprint, command, connection) + + if len(ret) == 0 { + panic("no return value specified for CompileCreateTable") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string, string) string); ok { + r0 = rf(blueprint, command, connection) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileCreateTable_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileCreateTable' +type Grammar_CompileCreateTable_Call struct { + *mock.Call +} + +// CompileCreateTable is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +// - connection string +func (_e *Grammar_Expecter) CompileCreateTable(blueprint interface{}, command interface{}, connection interface{}) *Grammar_CompileCreateTable_Call { + return &Grammar_CompileCreateTable_Call{Call: _e.mock.On("CompileCreateTable", blueprint, command, connection)} +} + +func (_c *Grammar_CompileCreateTable_Call) Run(run func(blueprint schema.Blueprint, command string, connection string)) *Grammar_CompileCreateTable_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *Grammar_CompileCreateTable_Call) Return(_a0 string) *Grammar_CompileCreateTable_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileCreateTable_Call) RunAndReturn(run func(schema.Blueprint, string, string) string) *Grammar_CompileCreateTable_Call { + _c.Call.Return(run) + return _c +} + +// CompileDrop provides a mock function with given fields: blueprint, command +func (_m *Grammar) CompileDrop(blueprint schema.Blueprint, command string) string { + ret := _m.Called(blueprint, command) + + if len(ret) == 0 { + panic("no return value specified for CompileDrop") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, command) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileDrop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileDrop' +type Grammar_CompileDrop_Call struct { + *mock.Call +} + +// CompileDrop is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +func (_e *Grammar_Expecter) CompileDrop(blueprint interface{}, command interface{}) *Grammar_CompileDrop_Call { + return &Grammar_CompileDrop_Call{Call: _e.mock.On("CompileDrop", blueprint, command)} +} + +func (_c *Grammar_CompileDrop_Call) Run(run func(blueprint schema.Blueprint, command string)) *Grammar_CompileDrop_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileDrop_Call) Return(_a0 string) *Grammar_CompileDrop_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileDrop_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_CompileDrop_Call { + _c.Call.Return(run) + return _c +} + +// CompileDropAllTables provides a mock function with given fields: tables +func (_m *Grammar) CompileDropAllTables(tables []string) string { + ret := _m.Called(tables) + + if len(ret) == 0 { + panic("no return value specified for CompileDropAllTables") + } + + var r0 string + if rf, ok := ret.Get(0).(func([]string) string); ok { + r0 = rf(tables) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileDropAllTables_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileDropAllTables' +type Grammar_CompileDropAllTables_Call struct { + *mock.Call +} + +// CompileDropAllTables is a helper method to define mock.On call +// - tables []string +func (_e *Grammar_Expecter) CompileDropAllTables(tables interface{}) *Grammar_CompileDropAllTables_Call { + return &Grammar_CompileDropAllTables_Call{Call: _e.mock.On("CompileDropAllTables", tables)} +} + +func (_c *Grammar_CompileDropAllTables_Call) Run(run func(tables []string)) *Grammar_CompileDropAllTables_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]string)) + }) + return _c +} + +func (_c *Grammar_CompileDropAllTables_Call) Return(_a0 string) *Grammar_CompileDropAllTables_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileDropAllTables_Call) RunAndReturn(run func([]string) string) *Grammar_CompileDropAllTables_Call { + _c.Call.Return(run) + return _c +} + +// CompileDropAllViews provides a mock function with given fields: views +func (_m *Grammar) CompileDropAllViews(views []string) string { + ret := _m.Called(views) + + if len(ret) == 0 { + panic("no return value specified for CompileDropAllViews") + } + + var r0 string + if rf, ok := ret.Get(0).(func([]string) string); ok { + r0 = rf(views) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileDropAllViews_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileDropAllViews' +type Grammar_CompileDropAllViews_Call struct { + *mock.Call +} + +// CompileDropAllViews is a helper method to define mock.On call +// - views []string +func (_e *Grammar_Expecter) CompileDropAllViews(views interface{}) *Grammar_CompileDropAllViews_Call { + return &Grammar_CompileDropAllViews_Call{Call: _e.mock.On("CompileDropAllViews", views)} +} + +func (_c *Grammar_CompileDropAllViews_Call) Run(run func(views []string)) *Grammar_CompileDropAllViews_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]string)) + }) + return _c +} + +func (_c *Grammar_CompileDropAllViews_Call) Return(_a0 string) *Grammar_CompileDropAllViews_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileDropAllViews_Call) RunAndReturn(run func([]string) string) *Grammar_CompileDropAllViews_Call { + _c.Call.Return(run) + return _c +} + +// CompileDropColumn provides a mock function with given fields: blueprint, command +func (_m *Grammar) CompileDropColumn(blueprint schema.Blueprint, command string) string { + ret := _m.Called(blueprint, command) + + if len(ret) == 0 { + panic("no return value specified for CompileDropColumn") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, command) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileDropColumn_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileDropColumn' +type Grammar_CompileDropColumn_Call struct { + *mock.Call +} + +// CompileDropColumn is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +func (_e *Grammar_Expecter) CompileDropColumn(blueprint interface{}, command interface{}) *Grammar_CompileDropColumn_Call { + return &Grammar_CompileDropColumn_Call{Call: _e.mock.On("CompileDropColumn", blueprint, command)} +} + +func (_c *Grammar_CompileDropColumn_Call) Run(run func(blueprint schema.Blueprint, command string)) *Grammar_CompileDropColumn_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileDropColumn_Call) Return(_a0 string) *Grammar_CompileDropColumn_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileDropColumn_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_CompileDropColumn_Call { + _c.Call.Return(run) + return _c +} + +// CompileDropIfExists provides a mock function with given fields: blueprint, command +func (_m *Grammar) CompileDropIfExists(blueprint schema.Blueprint, command string) string { + ret := _m.Called(blueprint, command) + + if len(ret) == 0 { + panic("no return value specified for CompileDropIfExists") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, command) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileDropIfExists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileDropIfExists' +type Grammar_CompileDropIfExists_Call struct { + *mock.Call +} + +// CompileDropIfExists is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +func (_e *Grammar_Expecter) CompileDropIfExists(blueprint interface{}, command interface{}) *Grammar_CompileDropIfExists_Call { + return &Grammar_CompileDropIfExists_Call{Call: _e.mock.On("CompileDropIfExists", blueprint, command)} +} + +func (_c *Grammar_CompileDropIfExists_Call) Run(run func(blueprint schema.Blueprint, command string)) *Grammar_CompileDropIfExists_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileDropIfExists_Call) Return(_a0 string) *Grammar_CompileDropIfExists_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileDropIfExists_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_CompileDropIfExists_Call { + _c.Call.Return(run) + return _c +} + +// CompileDropIndex provides a mock function with given fields: blueprint, command +func (_m *Grammar) CompileDropIndex(blueprint schema.Blueprint, command string) string { + ret := _m.Called(blueprint, command) + + if len(ret) == 0 { + panic("no return value specified for CompileDropIndex") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, command) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileDropIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileDropIndex' +type Grammar_CompileDropIndex_Call struct { + *mock.Call +} + +// CompileDropIndex is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +func (_e *Grammar_Expecter) CompileDropIndex(blueprint interface{}, command interface{}) *Grammar_CompileDropIndex_Call { + return &Grammar_CompileDropIndex_Call{Call: _e.mock.On("CompileDropIndex", blueprint, command)} +} + +func (_c *Grammar_CompileDropIndex_Call) Run(run func(blueprint schema.Blueprint, command string)) *Grammar_CompileDropIndex_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileDropIndex_Call) Return(_a0 string) *Grammar_CompileDropIndex_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileDropIndex_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_CompileDropIndex_Call { + _c.Call.Return(run) + return _c +} + +// CompileDropPrimary provides a mock function with given fields: blueprint, command +func (_m *Grammar) CompileDropPrimary(blueprint schema.Blueprint, command string) string { + ret := _m.Called(blueprint, command) + + if len(ret) == 0 { + panic("no return value specified for CompileDropPrimary") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, command) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileDropPrimary_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileDropPrimary' +type Grammar_CompileDropPrimary_Call struct { + *mock.Call +} + +// CompileDropPrimary is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +func (_e *Grammar_Expecter) CompileDropPrimary(blueprint interface{}, command interface{}) *Grammar_CompileDropPrimary_Call { + return &Grammar_CompileDropPrimary_Call{Call: _e.mock.On("CompileDropPrimary", blueprint, command)} +} + +func (_c *Grammar_CompileDropPrimary_Call) Run(run func(blueprint schema.Blueprint, command string)) *Grammar_CompileDropPrimary_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileDropPrimary_Call) Return(_a0 string) *Grammar_CompileDropPrimary_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileDropPrimary_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_CompileDropPrimary_Call { + _c.Call.Return(run) + return _c +} + +// CompileDropUnique provides a mock function with given fields: blueprint, command +func (_m *Grammar) CompileDropUnique(blueprint schema.Blueprint, command string) string { + ret := _m.Called(blueprint, command) + + if len(ret) == 0 { + panic("no return value specified for CompileDropUnique") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, command) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileDropUnique_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileDropUnique' +type Grammar_CompileDropUnique_Call struct { + *mock.Call +} + +// CompileDropUnique is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +func (_e *Grammar_Expecter) CompileDropUnique(blueprint interface{}, command interface{}) *Grammar_CompileDropUnique_Call { + return &Grammar_CompileDropUnique_Call{Call: _e.mock.On("CompileDropUnique", blueprint, command)} +} + +func (_c *Grammar_CompileDropUnique_Call) Run(run func(blueprint schema.Blueprint, command string)) *Grammar_CompileDropUnique_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileDropUnique_Call) Return(_a0 string) *Grammar_CompileDropUnique_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileDropUnique_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_CompileDropUnique_Call { + _c.Call.Return(run) + return _c +} + +// CompileIndex provides a mock function with given fields: blueprint, command +func (_m *Grammar) CompileIndex(blueprint schema.Blueprint, command string) string { + ret := _m.Called(blueprint, command) + + if len(ret) == 0 { + panic("no return value specified for CompileIndex") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, command) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileIndex' +type Grammar_CompileIndex_Call struct { + *mock.Call +} + +// CompileIndex is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +func (_e *Grammar_Expecter) CompileIndex(blueprint interface{}, command interface{}) *Grammar_CompileIndex_Call { + return &Grammar_CompileIndex_Call{Call: _e.mock.On("CompileIndex", blueprint, command)} +} + +func (_c *Grammar_CompileIndex_Call) Run(run func(blueprint schema.Blueprint, command string)) *Grammar_CompileIndex_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileIndex_Call) Return(_a0 string) *Grammar_CompileIndex_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileIndex_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_CompileIndex_Call { + _c.Call.Return(run) + return _c +} + +// CompileIndexes provides a mock function with given fields: database, table +func (_m *Grammar) CompileIndexes(database string, table string) string { + ret := _m.Called(database, table) + + if len(ret) == 0 { + panic("no return value specified for CompileIndexes") + } + + var r0 string + if rf, ok := ret.Get(0).(func(string, string) string); ok { + r0 = rf(database, table) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileIndexes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileIndexes' +type Grammar_CompileIndexes_Call struct { + *mock.Call +} + +// CompileIndexes is a helper method to define mock.On call +// - database string +// - table string +func (_e *Grammar_Expecter) CompileIndexes(database interface{}, table interface{}) *Grammar_CompileIndexes_Call { + return &Grammar_CompileIndexes_Call{Call: _e.mock.On("CompileIndexes", database, table)} +} + +func (_c *Grammar_CompileIndexes_Call) Run(run func(database string, table string)) *Grammar_CompileIndexes_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileIndexes_Call) Return(_a0 string) *Grammar_CompileIndexes_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileIndexes_Call) RunAndReturn(run func(string, string) string) *Grammar_CompileIndexes_Call { + _c.Call.Return(run) + return _c +} + +// CompilePrimary provides a mock function with given fields: blueprint, command +func (_m *Grammar) CompilePrimary(blueprint schema.Blueprint, command string) string { + ret := _m.Called(blueprint, command) + + if len(ret) == 0 { + panic("no return value specified for CompilePrimary") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, command) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompilePrimary_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompilePrimary' +type Grammar_CompilePrimary_Call struct { + *mock.Call +} + +// CompilePrimary is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +func (_e *Grammar_Expecter) CompilePrimary(blueprint interface{}, command interface{}) *Grammar_CompilePrimary_Call { + return &Grammar_CompilePrimary_Call{Call: _e.mock.On("CompilePrimary", blueprint, command)} +} + +func (_c *Grammar_CompilePrimary_Call) Run(run func(blueprint schema.Blueprint, command string)) *Grammar_CompilePrimary_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompilePrimary_Call) Return(_a0 string) *Grammar_CompilePrimary_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompilePrimary_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_CompilePrimary_Call { + _c.Call.Return(run) + return _c +} + +// CompileRename provides a mock function with given fields: blueprint, command +func (_m *Grammar) CompileRename(blueprint schema.Blueprint, command string) string { + ret := _m.Called(blueprint, command) + + if len(ret) == 0 { + panic("no return value specified for CompileRename") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, command) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileRename_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileRename' +type Grammar_CompileRename_Call struct { + *mock.Call +} + +// CompileRename is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +func (_e *Grammar_Expecter) CompileRename(blueprint interface{}, command interface{}) *Grammar_CompileRename_Call { + return &Grammar_CompileRename_Call{Call: _e.mock.On("CompileRename", blueprint, command)} +} + +func (_c *Grammar_CompileRename_Call) Run(run func(blueprint schema.Blueprint, command string)) *Grammar_CompileRename_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileRename_Call) Return(_a0 string) *Grammar_CompileRename_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileRename_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_CompileRename_Call { + _c.Call.Return(run) + return _c +} + +// CompileRenameColumn provides a mock function with given fields: blueprint, command, connection +func (_m *Grammar) CompileRenameColumn(blueprint schema.Blueprint, command string, connection string) string { + ret := _m.Called(blueprint, command, connection) + + if len(ret) == 0 { + panic("no return value specified for CompileRenameColumn") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string, string) string); ok { + r0 = rf(blueprint, command, connection) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileRenameColumn_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileRenameColumn' +type Grammar_CompileRenameColumn_Call struct { + *mock.Call +} + +// CompileRenameColumn is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +// - connection string +func (_e *Grammar_Expecter) CompileRenameColumn(blueprint interface{}, command interface{}, connection interface{}) *Grammar_CompileRenameColumn_Call { + return &Grammar_CompileRenameColumn_Call{Call: _e.mock.On("CompileRenameColumn", blueprint, command, connection)} +} + +func (_c *Grammar_CompileRenameColumn_Call) Run(run func(blueprint schema.Blueprint, command string, connection string)) *Grammar_CompileRenameColumn_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *Grammar_CompileRenameColumn_Call) Return(_a0 string) *Grammar_CompileRenameColumn_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileRenameColumn_Call) RunAndReturn(run func(schema.Blueprint, string, string) string) *Grammar_CompileRenameColumn_Call { + _c.Call.Return(run) + return _c +} + +// CompileRenameIndex provides a mock function with given fields: blueprint, command +func (_m *Grammar) CompileRenameIndex(blueprint schema.Blueprint, command string) string { + ret := _m.Called(blueprint, command) + + if len(ret) == 0 { + panic("no return value specified for CompileRenameIndex") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, command) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileRenameIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileRenameIndex' +type Grammar_CompileRenameIndex_Call struct { + *mock.Call +} + +// CompileRenameIndex is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +func (_e *Grammar_Expecter) CompileRenameIndex(blueprint interface{}, command interface{}) *Grammar_CompileRenameIndex_Call { + return &Grammar_CompileRenameIndex_Call{Call: _e.mock.On("CompileRenameIndex", blueprint, command)} +} + +func (_c *Grammar_CompileRenameIndex_Call) Run(run func(blueprint schema.Blueprint, command string)) *Grammar_CompileRenameIndex_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileRenameIndex_Call) Return(_a0 string) *Grammar_CompileRenameIndex_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileRenameIndex_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_CompileRenameIndex_Call { + _c.Call.Return(run) + return _c +} + +// CompileTableComment provides a mock function with given fields: blueprint, command +func (_m *Grammar) CompileTableComment(blueprint schema.Blueprint, command string) string { + ret := _m.Called(blueprint, command) + + if len(ret) == 0 { + panic("no return value specified for CompileTableComment") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, command) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileTableComment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileTableComment' +type Grammar_CompileTableComment_Call struct { + *mock.Call +} + +// CompileTableComment is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +func (_e *Grammar_Expecter) CompileTableComment(blueprint interface{}, command interface{}) *Grammar_CompileTableComment_Call { + return &Grammar_CompileTableComment_Call{Call: _e.mock.On("CompileTableComment", blueprint, command)} +} + +func (_c *Grammar_CompileTableComment_Call) Run(run func(blueprint schema.Blueprint, command string)) *Grammar_CompileTableComment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileTableComment_Call) Return(_a0 string) *Grammar_CompileTableComment_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileTableComment_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_CompileTableComment_Call { + _c.Call.Return(run) + return _c +} + +// CompileTables provides a mock function with given fields: database +func (_m *Grammar) CompileTables(database string) string { + ret := _m.Called(database) + + if len(ret) == 0 { + panic("no return value specified for CompileTables") + } + + var r0 string + if rf, ok := ret.Get(0).(func(string) string); ok { + r0 = rf(database) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileTables_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileTables' +type Grammar_CompileTables_Call struct { + *mock.Call +} + +// CompileTables is a helper method to define mock.On call +// - database string +func (_e *Grammar_Expecter) CompileTables(database interface{}) *Grammar_CompileTables_Call { + return &Grammar_CompileTables_Call{Call: _e.mock.On("CompileTables", database)} +} + +func (_c *Grammar_CompileTables_Call) Run(run func(database string)) *Grammar_CompileTables_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Grammar_CompileTables_Call) Return(_a0 string) *Grammar_CompileTables_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileTables_Call) RunAndReturn(run func(string) string) *Grammar_CompileTables_Call { + _c.Call.Return(run) + return _c +} + +// CompileUnique provides a mock function with given fields: blueprint, command +func (_m *Grammar) CompileUnique(blueprint schema.Blueprint, command string) string { + ret := _m.Called(blueprint, command) + + if len(ret) == 0 { + panic("no return value specified for CompileUnique") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, command) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileUnique_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileUnique' +type Grammar_CompileUnique_Call struct { + *mock.Call +} + +// CompileUnique is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - command string +func (_e *Grammar_Expecter) CompileUnique(blueprint interface{}, command interface{}) *Grammar_CompileUnique_Call { + return &Grammar_CompileUnique_Call{Call: _e.mock.On("CompileUnique", blueprint, command)} +} + +func (_c *Grammar_CompileUnique_Call) Run(run func(blueprint schema.Blueprint, command string)) *Grammar_CompileUnique_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_CompileUnique_Call) Return(_a0 string) *Grammar_CompileUnique_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileUnique_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_CompileUnique_Call { + _c.Call.Return(run) + return _c +} + +// CompileViews provides a mock function with given fields: database +func (_m *Grammar) CompileViews(database string) string { + ret := _m.Called(database) + + if len(ret) == 0 { + panic("no return value specified for CompileViews") + } + + var r0 string + if rf, ok := ret.Get(0).(func(string) string); ok { + r0 = rf(database) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_CompileViews_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompileViews' +type Grammar_CompileViews_Call struct { + *mock.Call +} + +// CompileViews is a helper method to define mock.On call +// - database string +func (_e *Grammar_Expecter) CompileViews(database interface{}) *Grammar_CompileViews_Call { + return &Grammar_CompileViews_Call{Call: _e.mock.On("CompileViews", database)} +} + +func (_c *Grammar_CompileViews_Call) Run(run func(database string)) *Grammar_CompileViews_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Grammar_CompileViews_Call) Return(_a0 string) *Grammar_CompileViews_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_CompileViews_Call) RunAndReturn(run func(string) string) *Grammar_CompileViews_Call { + _c.Call.Return(run) + return _c +} + +// ModifyDefault provides a mock function with given fields: blueprint, column +func (_m *Grammar) ModifyDefault(blueprint schema.Blueprint, column string) string { + ret := _m.Called(blueprint, column) + + if len(ret) == 0 { + panic("no return value specified for ModifyDefault") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_ModifyDefault_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ModifyDefault' +type Grammar_ModifyDefault_Call struct { + *mock.Call +} + +// ModifyDefault is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - column string +func (_e *Grammar_Expecter) ModifyDefault(blueprint interface{}, column interface{}) *Grammar_ModifyDefault_Call { + return &Grammar_ModifyDefault_Call{Call: _e.mock.On("ModifyDefault", blueprint, column)} +} + +func (_c *Grammar_ModifyDefault_Call) Run(run func(blueprint schema.Blueprint, column string)) *Grammar_ModifyDefault_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_ModifyDefault_Call) Return(_a0 string) *Grammar_ModifyDefault_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_ModifyDefault_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_ModifyDefault_Call { + _c.Call.Return(run) + return _c +} + +// ModifyNullable provides a mock function with given fields: blueprint, column +func (_m *Grammar) ModifyNullable(blueprint schema.Blueprint, column string) string { + ret := _m.Called(blueprint, column) + + if len(ret) == 0 { + panic("no return value specified for ModifyNullable") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.Blueprint, string) string); ok { + r0 = rf(blueprint, column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_ModifyNullable_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ModifyNullable' +type Grammar_ModifyNullable_Call struct { + *mock.Call +} + +// ModifyNullable is a helper method to define mock.On call +// - blueprint schema.Blueprint +// - column string +func (_e *Grammar_Expecter) ModifyNullable(blueprint interface{}, column interface{}) *Grammar_ModifyNullable_Call { + return &Grammar_ModifyNullable_Call{Call: _e.mock.On("ModifyNullable", blueprint, column)} +} + +func (_c *Grammar_ModifyNullable_Call) Run(run func(blueprint schema.Blueprint, column string)) *Grammar_ModifyNullable_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.Blueprint), args[1].(string)) + }) + return _c +} + +func (_c *Grammar_ModifyNullable_Call) Return(_a0 string) *Grammar_ModifyNullable_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_ModifyNullable_Call) RunAndReturn(run func(schema.Blueprint, string) string) *Grammar_ModifyNullable_Call { + _c.Call.Return(run) + return _c +} + +// TypeBigInteger provides a mock function with given fields: column +func (_m *Grammar) TypeBigInteger(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeBigInteger") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeBigInteger_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeBigInteger' +type Grammar_TypeBigInteger_Call struct { + *mock.Call +} + +// TypeBigInteger is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeBigInteger(column interface{}) *Grammar_TypeBigInteger_Call { + return &Grammar_TypeBigInteger_Call{Call: _e.mock.On("TypeBigInteger", column)} +} + +func (_c *Grammar_TypeBigInteger_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeBigInteger_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeBigInteger_Call) Return(_a0 string) *Grammar_TypeBigInteger_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeBigInteger_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeBigInteger_Call { + _c.Call.Return(run) + return _c +} + +// TypeBinary provides a mock function with given fields: column +func (_m *Grammar) TypeBinary(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeBinary") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeBinary_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeBinary' +type Grammar_TypeBinary_Call struct { + *mock.Call +} + +// TypeBinary is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeBinary(column interface{}) *Grammar_TypeBinary_Call { + return &Grammar_TypeBinary_Call{Call: _e.mock.On("TypeBinary", column)} +} + +func (_c *Grammar_TypeBinary_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeBinary_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeBinary_Call) Return(_a0 string) *Grammar_TypeBinary_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeBinary_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeBinary_Call { + _c.Call.Return(run) + return _c +} + +// TypeBoolean provides a mock function with given fields: column +func (_m *Grammar) TypeBoolean(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeBoolean") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeBoolean_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeBoolean' +type Grammar_TypeBoolean_Call struct { + *mock.Call +} + +// TypeBoolean is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeBoolean(column interface{}) *Grammar_TypeBoolean_Call { + return &Grammar_TypeBoolean_Call{Call: _e.mock.On("TypeBoolean", column)} +} + +func (_c *Grammar_TypeBoolean_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeBoolean_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeBoolean_Call) Return(_a0 string) *Grammar_TypeBoolean_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeBoolean_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeBoolean_Call { + _c.Call.Return(run) + return _c +} + +// TypeChar provides a mock function with given fields: column +func (_m *Grammar) TypeChar(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeChar") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeChar_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeChar' +type Grammar_TypeChar_Call struct { + *mock.Call +} + +// TypeChar is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeChar(column interface{}) *Grammar_TypeChar_Call { + return &Grammar_TypeChar_Call{Call: _e.mock.On("TypeChar", column)} +} + +func (_c *Grammar_TypeChar_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeChar_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeChar_Call) Return(_a0 string) *Grammar_TypeChar_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeChar_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeChar_Call { + _c.Call.Return(run) + return _c +} + +// TypeDate provides a mock function with given fields: column +func (_m *Grammar) TypeDate(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeDate") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeDate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeDate' +type Grammar_TypeDate_Call struct { + *mock.Call +} + +// TypeDate is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeDate(column interface{}) *Grammar_TypeDate_Call { + return &Grammar_TypeDate_Call{Call: _e.mock.On("TypeDate", column)} +} + +func (_c *Grammar_TypeDate_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeDate_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeDate_Call) Return(_a0 string) *Grammar_TypeDate_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeDate_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeDate_Call { + _c.Call.Return(run) + return _c +} + +// TypeDateTime provides a mock function with given fields: column +func (_m *Grammar) TypeDateTime(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeDateTime") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeDateTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeDateTime' +type Grammar_TypeDateTime_Call struct { + *mock.Call +} + +// TypeDateTime is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeDateTime(column interface{}) *Grammar_TypeDateTime_Call { + return &Grammar_TypeDateTime_Call{Call: _e.mock.On("TypeDateTime", column)} +} + +func (_c *Grammar_TypeDateTime_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeDateTime_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeDateTime_Call) Return(_a0 string) *Grammar_TypeDateTime_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeDateTime_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeDateTime_Call { + _c.Call.Return(run) + return _c +} + +// TypeDateTimeTz provides a mock function with given fields: column +func (_m *Grammar) TypeDateTimeTz(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeDateTimeTz") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeDateTimeTz_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeDateTimeTz' +type Grammar_TypeDateTimeTz_Call struct { + *mock.Call +} + +// TypeDateTimeTz is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeDateTimeTz(column interface{}) *Grammar_TypeDateTimeTz_Call { + return &Grammar_TypeDateTimeTz_Call{Call: _e.mock.On("TypeDateTimeTz", column)} +} + +func (_c *Grammar_TypeDateTimeTz_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeDateTimeTz_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeDateTimeTz_Call) Return(_a0 string) *Grammar_TypeDateTimeTz_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeDateTimeTz_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeDateTimeTz_Call { + _c.Call.Return(run) + return _c +} + +// TypeDecimal provides a mock function with given fields: column +func (_m *Grammar) TypeDecimal(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeDecimal") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeDecimal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeDecimal' +type Grammar_TypeDecimal_Call struct { + *mock.Call +} + +// TypeDecimal is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeDecimal(column interface{}) *Grammar_TypeDecimal_Call { + return &Grammar_TypeDecimal_Call{Call: _e.mock.On("TypeDecimal", column)} +} + +func (_c *Grammar_TypeDecimal_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeDecimal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeDecimal_Call) Return(_a0 string) *Grammar_TypeDecimal_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeDecimal_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeDecimal_Call { + _c.Call.Return(run) + return _c +} + +// TypeDouble provides a mock function with given fields: column +func (_m *Grammar) TypeDouble(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeDouble") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeDouble_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeDouble' +type Grammar_TypeDouble_Call struct { + *mock.Call +} + +// TypeDouble is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeDouble(column interface{}) *Grammar_TypeDouble_Call { + return &Grammar_TypeDouble_Call{Call: _e.mock.On("TypeDouble", column)} +} + +func (_c *Grammar_TypeDouble_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeDouble_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeDouble_Call) Return(_a0 string) *Grammar_TypeDouble_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeDouble_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeDouble_Call { + _c.Call.Return(run) + return _c +} + +// TypeEnum provides a mock function with given fields: column +func (_m *Grammar) TypeEnum(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeEnum") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeEnum_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeEnum' +type Grammar_TypeEnum_Call struct { + *mock.Call +} + +// TypeEnum is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeEnum(column interface{}) *Grammar_TypeEnum_Call { + return &Grammar_TypeEnum_Call{Call: _e.mock.On("TypeEnum", column)} +} + +func (_c *Grammar_TypeEnum_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeEnum_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeEnum_Call) Return(_a0 string) *Grammar_TypeEnum_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeEnum_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeEnum_Call { + _c.Call.Return(run) + return _c +} + +// TypeFloat provides a mock function with given fields: column +func (_m *Grammar) TypeFloat(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeFloat") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeFloat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeFloat' +type Grammar_TypeFloat_Call struct { + *mock.Call +} + +// TypeFloat is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeFloat(column interface{}) *Grammar_TypeFloat_Call { + return &Grammar_TypeFloat_Call{Call: _e.mock.On("TypeFloat", column)} +} + +func (_c *Grammar_TypeFloat_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeFloat_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeFloat_Call) Return(_a0 string) *Grammar_TypeFloat_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeFloat_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeFloat_Call { + _c.Call.Return(run) + return _c +} + +// TypeInteger provides a mock function with given fields: column +func (_m *Grammar) TypeInteger(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeInteger") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeInteger_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeInteger' +type Grammar_TypeInteger_Call struct { + *mock.Call +} + +// TypeInteger is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeInteger(column interface{}) *Grammar_TypeInteger_Call { + return &Grammar_TypeInteger_Call{Call: _e.mock.On("TypeInteger", column)} +} + +func (_c *Grammar_TypeInteger_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeInteger_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeInteger_Call) Return(_a0 string) *Grammar_TypeInteger_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeInteger_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeInteger_Call { + _c.Call.Return(run) + return _c +} + +// TypeJson provides a mock function with given fields: column +func (_m *Grammar) TypeJson(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeJson") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeJson_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeJson' +type Grammar_TypeJson_Call struct { + *mock.Call +} + +// TypeJson is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeJson(column interface{}) *Grammar_TypeJson_Call { + return &Grammar_TypeJson_Call{Call: _e.mock.On("TypeJson", column)} +} + +func (_c *Grammar_TypeJson_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeJson_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeJson_Call) Return(_a0 string) *Grammar_TypeJson_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeJson_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeJson_Call { + _c.Call.Return(run) + return _c +} + +// TypeJsonb provides a mock function with given fields: column +func (_m *Grammar) TypeJsonb(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeJsonb") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeJsonb_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeJsonb' +type Grammar_TypeJsonb_Call struct { + *mock.Call +} + +// TypeJsonb is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeJsonb(column interface{}) *Grammar_TypeJsonb_Call { + return &Grammar_TypeJsonb_Call{Call: _e.mock.On("TypeJsonb", column)} +} + +func (_c *Grammar_TypeJsonb_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeJsonb_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeJsonb_Call) Return(_a0 string) *Grammar_TypeJsonb_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeJsonb_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeJsonb_Call { + _c.Call.Return(run) + return _c +} + +// TypeString provides a mock function with given fields: column +func (_m *Grammar) TypeString(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeString") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeString_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeString' +type Grammar_TypeString_Call struct { + *mock.Call +} + +// TypeString is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeString(column interface{}) *Grammar_TypeString_Call { + return &Grammar_TypeString_Call{Call: _e.mock.On("TypeString", column)} +} + +func (_c *Grammar_TypeString_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeString_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeString_Call) Return(_a0 string) *Grammar_TypeString_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeString_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeString_Call { + _c.Call.Return(run) + return _c +} + +// TypeText provides a mock function with given fields: column +func (_m *Grammar) TypeText(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeText") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeText_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeText' +type Grammar_TypeText_Call struct { + *mock.Call +} + +// TypeText is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeText(column interface{}) *Grammar_TypeText_Call { + return &Grammar_TypeText_Call{Call: _e.mock.On("TypeText", column)} +} + +func (_c *Grammar_TypeText_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeText_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeText_Call) Return(_a0 string) *Grammar_TypeText_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeText_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeText_Call { + _c.Call.Return(run) + return _c +} + +// TypeTime provides a mock function with given fields: column +func (_m *Grammar) TypeTime(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeTime") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeTime' +type Grammar_TypeTime_Call struct { + *mock.Call +} + +// TypeTime is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeTime(column interface{}) *Grammar_TypeTime_Call { + return &Grammar_TypeTime_Call{Call: _e.mock.On("TypeTime", column)} +} + +func (_c *Grammar_TypeTime_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeTime_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeTime_Call) Return(_a0 string) *Grammar_TypeTime_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeTime_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeTime_Call { + _c.Call.Return(run) + return _c +} + +// TypeTimeTz provides a mock function with given fields: column +func (_m *Grammar) TypeTimeTz(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeTimeTz") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeTimeTz_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeTimeTz' +type Grammar_TypeTimeTz_Call struct { + *mock.Call +} + +// TypeTimeTz is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeTimeTz(column interface{}) *Grammar_TypeTimeTz_Call { + return &Grammar_TypeTimeTz_Call{Call: _e.mock.On("TypeTimeTz", column)} +} + +func (_c *Grammar_TypeTimeTz_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeTimeTz_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeTimeTz_Call) Return(_a0 string) *Grammar_TypeTimeTz_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeTimeTz_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeTimeTz_Call { + _c.Call.Return(run) + return _c +} + +// TypeTimestamp provides a mock function with given fields: column +func (_m *Grammar) TypeTimestamp(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeTimestamp") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeTimestamp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeTimestamp' +type Grammar_TypeTimestamp_Call struct { + *mock.Call +} + +// TypeTimestamp is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeTimestamp(column interface{}) *Grammar_TypeTimestamp_Call { + return &Grammar_TypeTimestamp_Call{Call: _e.mock.On("TypeTimestamp", column)} +} + +func (_c *Grammar_TypeTimestamp_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeTimestamp_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeTimestamp_Call) Return(_a0 string) *Grammar_TypeTimestamp_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeTimestamp_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeTimestamp_Call { + _c.Call.Return(run) + return _c +} + +// TypeTimestampTz provides a mock function with given fields: column +func (_m *Grammar) TypeTimestampTz(column schema.ColumnDefinition) string { + ret := _m.Called(column) + + if len(ret) == 0 { + panic("no return value specified for TypeTimestampTz") + } + + var r0 string + if rf, ok := ret.Get(0).(func(schema.ColumnDefinition) string); ok { + r0 = rf(column) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Grammar_TypeTimestampTz_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TypeTimestampTz' +type Grammar_TypeTimestampTz_Call struct { + *mock.Call +} + +// TypeTimestampTz is a helper method to define mock.On call +// - column schema.ColumnDefinition +func (_e *Grammar_Expecter) TypeTimestampTz(column interface{}) *Grammar_TypeTimestampTz_Call { + return &Grammar_TypeTimestampTz_Call{Call: _e.mock.On("TypeTimestampTz", column)} +} + +func (_c *Grammar_TypeTimestampTz_Call) Run(run func(column schema.ColumnDefinition)) *Grammar_TypeTimestampTz_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(schema.ColumnDefinition)) + }) + return _c +} + +func (_c *Grammar_TypeTimestampTz_Call) Return(_a0 string) *Grammar_TypeTimestampTz_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Grammar_TypeTimestampTz_Call) RunAndReturn(run func(schema.ColumnDefinition) string) *Grammar_TypeTimestampTz_Call { + _c.Call.Return(run) + return _c +} + +// NewGrammar creates a new instance of Grammar. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewGrammar(t interface { + mock.TestingT + Cleanup(func()) +}) *Grammar { + mock := &Grammar{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/database/schema/Migration.go b/mocks/database/schema/Migration.go new file mode 100644 index 000000000..9d18c20ec --- /dev/null +++ b/mocks/database/schema/Migration.go @@ -0,0 +1,167 @@ +// Code generated by mockery v2.39.1. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" + +// Migration is an autogenerated mock type for the Migration type +type Migration struct { + mock.Mock +} + +type Migration_Expecter struct { + mock *mock.Mock +} + +func (_m *Migration) EXPECT() *Migration_Expecter { + return &Migration_Expecter{mock: &_m.Mock} +} + +// Down provides a mock function with given fields: +func (_m *Migration) Down() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Down") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Migration_Down_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Down' +type Migration_Down_Call struct { + *mock.Call +} + +// Down is a helper method to define mock.On call +func (_e *Migration_Expecter) Down() *Migration_Down_Call { + return &Migration_Down_Call{Call: _e.mock.On("Down")} +} + +func (_c *Migration_Down_Call) Run(run func()) *Migration_Down_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Migration_Down_Call) Return(_a0 error) *Migration_Down_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Migration_Down_Call) RunAndReturn(run func() error) *Migration_Down_Call { + _c.Call.Return(run) + return _c +} + +// Signature provides a mock function with given fields: +func (_m *Migration) Signature() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Signature") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Migration_Signature_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Signature' +type Migration_Signature_Call struct { + *mock.Call +} + +// Signature is a helper method to define mock.On call +func (_e *Migration_Expecter) Signature() *Migration_Signature_Call { + return &Migration_Signature_Call{Call: _e.mock.On("Signature")} +} + +func (_c *Migration_Signature_Call) Run(run func()) *Migration_Signature_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Migration_Signature_Call) Return(_a0 string) *Migration_Signature_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Migration_Signature_Call) RunAndReturn(run func() string) *Migration_Signature_Call { + _c.Call.Return(run) + return _c +} + +// Up provides a mock function with given fields: +func (_m *Migration) Up() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Up") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Migration_Up_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Up' +type Migration_Up_Call struct { + *mock.Call +} + +// Up is a helper method to define mock.On call +func (_e *Migration_Expecter) Up() *Migration_Up_Call { + return &Migration_Up_Call{Call: _e.mock.On("Up")} +} + +func (_c *Migration_Up_Call) Run(run func()) *Migration_Up_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Migration_Up_Call) Return(_a0 error) *Migration_Up_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Migration_Up_Call) RunAndReturn(run func() error) *Migration_Up_Call { + _c.Call.Return(run) + return _c +} + +// NewMigration creates a new instance of Migration. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMigration(t interface { + mock.TestingT + Cleanup(func()) +}) *Migration { + mock := &Migration{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/database/schema/Schema.go b/mocks/database/schema/Schema.go new file mode 100644 index 000000000..143719dc0 --- /dev/null +++ b/mocks/database/schema/Schema.go @@ -0,0 +1,1036 @@ +// Code generated by mockery v2.39.1. DO NOT EDIT. + +package mocks + +import ( + schema "github.com/goravel/framework/contracts/database/schema" + mock "github.com/stretchr/testify/mock" +) + +// Schema is an autogenerated mock type for the Schema type +type Schema struct { + mock.Mock +} + +type Schema_Expecter struct { + mock *mock.Mock +} + +func (_m *Schema) EXPECT() *Schema_Expecter { + return &Schema_Expecter{mock: &_m.Mock} +} + +// Connection provides a mock function with given fields: name +func (_m *Schema) Connection(name string) schema.Schema { + ret := _m.Called(name) + + if len(ret) == 0 { + panic("no return value specified for Connection") + } + + var r0 schema.Schema + if rf, ok := ret.Get(0).(func(string) schema.Schema); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.Schema) + } + } + + return r0 +} + +// Schema_Connection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Connection' +type Schema_Connection_Call struct { + *mock.Call +} + +// Connection is a helper method to define mock.On call +// - name string +func (_e *Schema_Expecter) Connection(name interface{}) *Schema_Connection_Call { + return &Schema_Connection_Call{Call: _e.mock.On("Connection", name)} +} + +func (_c *Schema_Connection_Call) Run(run func(name string)) *Schema_Connection_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Schema_Connection_Call) Return(_a0 schema.Schema) *Schema_Connection_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_Connection_Call) RunAndReturn(run func(string) schema.Schema) *Schema_Connection_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function with given fields: table, callback +func (_m *Schema) Create(table string, callback func(schema.Blueprint)) error { + ret := _m.Called(table, callback) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string, func(schema.Blueprint)) error); ok { + r0 = rf(table, callback) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Schema_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type Schema_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - table string +// - callback func(schema.Blueprint) +func (_e *Schema_Expecter) Create(table interface{}, callback interface{}) *Schema_Create_Call { + return &Schema_Create_Call{Call: _e.mock.On("Create", table, callback)} +} + +func (_c *Schema_Create_Call) Run(run func(table string, callback func(schema.Blueprint))) *Schema_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(func(schema.Blueprint))) + }) + return _c +} + +func (_c *Schema_Create_Call) Return(_a0 error) *Schema_Create_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_Create_Call) RunAndReturn(run func(string, func(schema.Blueprint)) error) *Schema_Create_Call { + _c.Call.Return(run) + return _c +} + +// Drop provides a mock function with given fields: table +func (_m *Schema) Drop(table string) error { + ret := _m.Called(table) + + if len(ret) == 0 { + panic("no return value specified for Drop") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(table) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Schema_Drop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Drop' +type Schema_Drop_Call struct { + *mock.Call +} + +// Drop is a helper method to define mock.On call +// - table string +func (_e *Schema_Expecter) Drop(table interface{}) *Schema_Drop_Call { + return &Schema_Drop_Call{Call: _e.mock.On("Drop", table)} +} + +func (_c *Schema_Drop_Call) Run(run func(table string)) *Schema_Drop_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Schema_Drop_Call) Return(_a0 error) *Schema_Drop_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_Drop_Call) RunAndReturn(run func(string) error) *Schema_Drop_Call { + _c.Call.Return(run) + return _c +} + +// DropAllTables provides a mock function with given fields: +func (_m *Schema) DropAllTables() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for DropAllTables") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Schema_DropAllTables_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropAllTables' +type Schema_DropAllTables_Call struct { + *mock.Call +} + +// DropAllTables is a helper method to define mock.On call +func (_e *Schema_Expecter) DropAllTables() *Schema_DropAllTables_Call { + return &Schema_DropAllTables_Call{Call: _e.mock.On("DropAllTables")} +} + +func (_c *Schema_DropAllTables_Call) Run(run func()) *Schema_DropAllTables_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Schema_DropAllTables_Call) Return(_a0 error) *Schema_DropAllTables_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_DropAllTables_Call) RunAndReturn(run func() error) *Schema_DropAllTables_Call { + _c.Call.Return(run) + return _c +} + +// DropAllViews provides a mock function with given fields: +func (_m *Schema) DropAllViews() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for DropAllViews") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Schema_DropAllViews_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropAllViews' +type Schema_DropAllViews_Call struct { + *mock.Call +} + +// DropAllViews is a helper method to define mock.On call +func (_e *Schema_Expecter) DropAllViews() *Schema_DropAllViews_Call { + return &Schema_DropAllViews_Call{Call: _e.mock.On("DropAllViews")} +} + +func (_c *Schema_DropAllViews_Call) Run(run func()) *Schema_DropAllViews_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Schema_DropAllViews_Call) Return(_a0 error) *Schema_DropAllViews_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_DropAllViews_Call) RunAndReturn(run func() error) *Schema_DropAllViews_Call { + _c.Call.Return(run) + return _c +} + +// DropColumns provides a mock function with given fields: table, columns +func (_m *Schema) DropColumns(table string, columns []string) error { + ret := _m.Called(table, columns) + + if len(ret) == 0 { + panic("no return value specified for DropColumns") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string, []string) error); ok { + r0 = rf(table, columns) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Schema_DropColumns_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropColumns' +type Schema_DropColumns_Call struct { + *mock.Call +} + +// DropColumns is a helper method to define mock.On call +// - table string +// - columns []string +func (_e *Schema_Expecter) DropColumns(table interface{}, columns interface{}) *Schema_DropColumns_Call { + return &Schema_DropColumns_Call{Call: _e.mock.On("DropColumns", table, columns)} +} + +func (_c *Schema_DropColumns_Call) Run(run func(table string, columns []string)) *Schema_DropColumns_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([]string)) + }) + return _c +} + +func (_c *Schema_DropColumns_Call) Return(_a0 error) *Schema_DropColumns_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_DropColumns_Call) RunAndReturn(run func(string, []string) error) *Schema_DropColumns_Call { + _c.Call.Return(run) + return _c +} + +// DropIfExists provides a mock function with given fields: table +func (_m *Schema) DropIfExists(table string) error { + ret := _m.Called(table) + + if len(ret) == 0 { + panic("no return value specified for DropIfExists") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(table) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Schema_DropIfExists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropIfExists' +type Schema_DropIfExists_Call struct { + *mock.Call +} + +// DropIfExists is a helper method to define mock.On call +// - table string +func (_e *Schema_Expecter) DropIfExists(table interface{}) *Schema_DropIfExists_Call { + return &Schema_DropIfExists_Call{Call: _e.mock.On("DropIfExists", table)} +} + +func (_c *Schema_DropIfExists_Call) Run(run func(table string)) *Schema_DropIfExists_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Schema_DropIfExists_Call) Return(_a0 error) *Schema_DropIfExists_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_DropIfExists_Call) RunAndReturn(run func(string) error) *Schema_DropIfExists_Call { + _c.Call.Return(run) + return _c +} + +// GetColumnListing provides a mock function with given fields: table +func (_m *Schema) GetColumnListing(table string) []string { + ret := _m.Called(table) + + if len(ret) == 0 { + panic("no return value specified for GetColumnListing") + } + + var r0 []string + if rf, ok := ret.Get(0).(func(string) []string); ok { + r0 = rf(table) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + return r0 +} + +// Schema_GetColumnListing_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetColumnListing' +type Schema_GetColumnListing_Call struct { + *mock.Call +} + +// GetColumnListing is a helper method to define mock.On call +// - table string +func (_e *Schema_Expecter) GetColumnListing(table interface{}) *Schema_GetColumnListing_Call { + return &Schema_GetColumnListing_Call{Call: _e.mock.On("GetColumnListing", table)} +} + +func (_c *Schema_GetColumnListing_Call) Run(run func(table string)) *Schema_GetColumnListing_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Schema_GetColumnListing_Call) Return(_a0 []string) *Schema_GetColumnListing_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_GetColumnListing_Call) RunAndReturn(run func(string) []string) *Schema_GetColumnListing_Call { + _c.Call.Return(run) + return _c +} + +// GetColumns provides a mock function with given fields: table +func (_m *Schema) GetColumns(table string) []schema.ColumnDefinition { + ret := _m.Called(table) + + if len(ret) == 0 { + panic("no return value specified for GetColumns") + } + + var r0 []schema.ColumnDefinition + if rf, ok := ret.Get(0).(func(string) []schema.ColumnDefinition); ok { + r0 = rf(table) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]schema.ColumnDefinition) + } + } + + return r0 +} + +// Schema_GetColumns_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetColumns' +type Schema_GetColumns_Call struct { + *mock.Call +} + +// GetColumns is a helper method to define mock.On call +// - table string +func (_e *Schema_Expecter) GetColumns(table interface{}) *Schema_GetColumns_Call { + return &Schema_GetColumns_Call{Call: _e.mock.On("GetColumns", table)} +} + +func (_c *Schema_GetColumns_Call) Run(run func(table string)) *Schema_GetColumns_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Schema_GetColumns_Call) Return(_a0 []schema.ColumnDefinition) *Schema_GetColumns_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_GetColumns_Call) RunAndReturn(run func(string) []schema.ColumnDefinition) *Schema_GetColumns_Call { + _c.Call.Return(run) + return _c +} + +// GetIndexListing provides a mock function with given fields: table +func (_m *Schema) GetIndexListing(table string) []string { + ret := _m.Called(table) + + if len(ret) == 0 { + panic("no return value specified for GetIndexListing") + } + + var r0 []string + if rf, ok := ret.Get(0).(func(string) []string); ok { + r0 = rf(table) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + return r0 +} + +// Schema_GetIndexListing_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIndexListing' +type Schema_GetIndexListing_Call struct { + *mock.Call +} + +// GetIndexListing is a helper method to define mock.On call +// - table string +func (_e *Schema_Expecter) GetIndexListing(table interface{}) *Schema_GetIndexListing_Call { + return &Schema_GetIndexListing_Call{Call: _e.mock.On("GetIndexListing", table)} +} + +func (_c *Schema_GetIndexListing_Call) Run(run func(table string)) *Schema_GetIndexListing_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Schema_GetIndexListing_Call) Return(_a0 []string) *Schema_GetIndexListing_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_GetIndexListing_Call) RunAndReturn(run func(string) []string) *Schema_GetIndexListing_Call { + _c.Call.Return(run) + return _c +} + +// GetIndexes provides a mock function with given fields: table +func (_m *Schema) GetIndexes(table string) []schema.Index { + ret := _m.Called(table) + + if len(ret) == 0 { + panic("no return value specified for GetIndexes") + } + + var r0 []schema.Index + if rf, ok := ret.Get(0).(func(string) []schema.Index); ok { + r0 = rf(table) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]schema.Index) + } + } + + return r0 +} + +// Schema_GetIndexes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIndexes' +type Schema_GetIndexes_Call struct { + *mock.Call +} + +// GetIndexes is a helper method to define mock.On call +// - table string +func (_e *Schema_Expecter) GetIndexes(table interface{}) *Schema_GetIndexes_Call { + return &Schema_GetIndexes_Call{Call: _e.mock.On("GetIndexes", table)} +} + +func (_c *Schema_GetIndexes_Call) Run(run func(table string)) *Schema_GetIndexes_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Schema_GetIndexes_Call) Return(_a0 []schema.Index) *Schema_GetIndexes_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_GetIndexes_Call) RunAndReturn(run func(string) []schema.Index) *Schema_GetIndexes_Call { + _c.Call.Return(run) + return _c +} + +// GetTableListing provides a mock function with given fields: +func (_m *Schema) GetTableListing() []string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetTableListing") + } + + var r0 []string + if rf, ok := ret.Get(0).(func() []string); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + return r0 +} + +// Schema_GetTableListing_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTableListing' +type Schema_GetTableListing_Call struct { + *mock.Call +} + +// GetTableListing is a helper method to define mock.On call +func (_e *Schema_Expecter) GetTableListing() *Schema_GetTableListing_Call { + return &Schema_GetTableListing_Call{Call: _e.mock.On("GetTableListing")} +} + +func (_c *Schema_GetTableListing_Call) Run(run func()) *Schema_GetTableListing_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Schema_GetTableListing_Call) Return(_a0 []string) *Schema_GetTableListing_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_GetTableListing_Call) RunAndReturn(run func() []string) *Schema_GetTableListing_Call { + _c.Call.Return(run) + return _c +} + +// GetTables provides a mock function with given fields: +func (_m *Schema) GetTables() ([]schema.Table, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetTables") + } + + var r0 []schema.Table + var r1 error + if rf, ok := ret.Get(0).(func() ([]schema.Table, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() []schema.Table); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]schema.Table) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Schema_GetTables_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTables' +type Schema_GetTables_Call struct { + *mock.Call +} + +// GetTables is a helper method to define mock.On call +func (_e *Schema_Expecter) GetTables() *Schema_GetTables_Call { + return &Schema_GetTables_Call{Call: _e.mock.On("GetTables")} +} + +func (_c *Schema_GetTables_Call) Run(run func()) *Schema_GetTables_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Schema_GetTables_Call) Return(_a0 []schema.Table, _a1 error) *Schema_GetTables_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Schema_GetTables_Call) RunAndReturn(run func() ([]schema.Table, error)) *Schema_GetTables_Call { + _c.Call.Return(run) + return _c +} + +// GetViews provides a mock function with given fields: +func (_m *Schema) GetViews() []schema.View { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetViews") + } + + var r0 []schema.View + if rf, ok := ret.Get(0).(func() []schema.View); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]schema.View) + } + } + + return r0 +} + +// Schema_GetViews_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetViews' +type Schema_GetViews_Call struct { + *mock.Call +} + +// GetViews is a helper method to define mock.On call +func (_e *Schema_Expecter) GetViews() *Schema_GetViews_Call { + return &Schema_GetViews_Call{Call: _e.mock.On("GetViews")} +} + +func (_c *Schema_GetViews_Call) Run(run func()) *Schema_GetViews_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Schema_GetViews_Call) Return(_a0 []schema.View) *Schema_GetViews_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_GetViews_Call) RunAndReturn(run func() []schema.View) *Schema_GetViews_Call { + _c.Call.Return(run) + return _c +} + +// HasColumn provides a mock function with given fields: table, column +func (_m *Schema) HasColumn(table string, column string) bool { + ret := _m.Called(table, column) + + if len(ret) == 0 { + panic("no return value specified for HasColumn") + } + + var r0 bool + if rf, ok := ret.Get(0).(func(string, string) bool); ok { + r0 = rf(table, column) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// Schema_HasColumn_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasColumn' +type Schema_HasColumn_Call struct { + *mock.Call +} + +// HasColumn is a helper method to define mock.On call +// - table string +// - column string +func (_e *Schema_Expecter) HasColumn(table interface{}, column interface{}) *Schema_HasColumn_Call { + return &Schema_HasColumn_Call{Call: _e.mock.On("HasColumn", table, column)} +} + +func (_c *Schema_HasColumn_Call) Run(run func(table string, column string)) *Schema_HasColumn_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Schema_HasColumn_Call) Return(_a0 bool) *Schema_HasColumn_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_HasColumn_Call) RunAndReturn(run func(string, string) bool) *Schema_HasColumn_Call { + _c.Call.Return(run) + return _c +} + +// HasColumns provides a mock function with given fields: table, columns +func (_m *Schema) HasColumns(table string, columns []string) bool { + ret := _m.Called(table, columns) + + if len(ret) == 0 { + panic("no return value specified for HasColumns") + } + + var r0 bool + if rf, ok := ret.Get(0).(func(string, []string) bool); ok { + r0 = rf(table, columns) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// Schema_HasColumns_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasColumns' +type Schema_HasColumns_Call struct { + *mock.Call +} + +// HasColumns is a helper method to define mock.On call +// - table string +// - columns []string +func (_e *Schema_Expecter) HasColumns(table interface{}, columns interface{}) *Schema_HasColumns_Call { + return &Schema_HasColumns_Call{Call: _e.mock.On("HasColumns", table, columns)} +} + +func (_c *Schema_HasColumns_Call) Run(run func(table string, columns []string)) *Schema_HasColumns_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([]string)) + }) + return _c +} + +func (_c *Schema_HasColumns_Call) Return(_a0 bool) *Schema_HasColumns_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_HasColumns_Call) RunAndReturn(run func(string, []string) bool) *Schema_HasColumns_Call { + _c.Call.Return(run) + return _c +} + +// HasIndex provides a mock function with given fields: table, index +func (_m *Schema) HasIndex(table string, index string) { + _m.Called(table, index) +} + +// Schema_HasIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasIndex' +type Schema_HasIndex_Call struct { + *mock.Call +} + +// HasIndex is a helper method to define mock.On call +// - table string +// - index string +func (_e *Schema_Expecter) HasIndex(table interface{}, index interface{}) *Schema_HasIndex_Call { + return &Schema_HasIndex_Call{Call: _e.mock.On("HasIndex", table, index)} +} + +func (_c *Schema_HasIndex_Call) Run(run func(table string, index string)) *Schema_HasIndex_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Schema_HasIndex_Call) Return() *Schema_HasIndex_Call { + _c.Call.Return() + return _c +} + +func (_c *Schema_HasIndex_Call) RunAndReturn(run func(string, string)) *Schema_HasIndex_Call { + _c.Call.Return(run) + return _c +} + +// HasTable provides a mock function with given fields: table +func (_m *Schema) HasTable(table string) bool { + ret := _m.Called(table) + + if len(ret) == 0 { + panic("no return value specified for HasTable") + } + + var r0 bool + if rf, ok := ret.Get(0).(func(string) bool); ok { + r0 = rf(table) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// Schema_HasTable_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasTable' +type Schema_HasTable_Call struct { + *mock.Call +} + +// HasTable is a helper method to define mock.On call +// - table string +func (_e *Schema_Expecter) HasTable(table interface{}) *Schema_HasTable_Call { + return &Schema_HasTable_Call{Call: _e.mock.On("HasTable", table)} +} + +func (_c *Schema_HasTable_Call) Run(run func(table string)) *Schema_HasTable_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Schema_HasTable_Call) Return(_a0 bool) *Schema_HasTable_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_HasTable_Call) RunAndReturn(run func(string) bool) *Schema_HasTable_Call { + _c.Call.Return(run) + return _c +} + +// HasView provides a mock function with given fields: view +func (_m *Schema) HasView(view string) bool { + ret := _m.Called(view) + + if len(ret) == 0 { + panic("no return value specified for HasView") + } + + var r0 bool + if rf, ok := ret.Get(0).(func(string) bool); ok { + r0 = rf(view) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// Schema_HasView_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasView' +type Schema_HasView_Call struct { + *mock.Call +} + +// HasView is a helper method to define mock.On call +// - view string +func (_e *Schema_Expecter) HasView(view interface{}) *Schema_HasView_Call { + return &Schema_HasView_Call{Call: _e.mock.On("HasView", view)} +} + +func (_c *Schema_HasView_Call) Run(run func(view string)) *Schema_HasView_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Schema_HasView_Call) Return(_a0 bool) *Schema_HasView_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_HasView_Call) RunAndReturn(run func(string) bool) *Schema_HasView_Call { + _c.Call.Return(run) + return _c +} + +// Register provides a mock function with given fields: _a0 +func (_m *Schema) Register(_a0 []schema.Migration) { + _m.Called(_a0) +} + +// Schema_Register_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Register' +type Schema_Register_Call struct { + *mock.Call +} + +// Register is a helper method to define mock.On call +// - _a0 []schema.Migration +func (_e *Schema_Expecter) Register(_a0 interface{}) *Schema_Register_Call { + return &Schema_Register_Call{Call: _e.mock.On("Register", _a0)} +} + +func (_c *Schema_Register_Call) Run(run func(_a0 []schema.Migration)) *Schema_Register_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]schema.Migration)) + }) + return _c +} + +func (_c *Schema_Register_Call) Return() *Schema_Register_Call { + _c.Call.Return() + return _c +} + +func (_c *Schema_Register_Call) RunAndReturn(run func([]schema.Migration)) *Schema_Register_Call { + _c.Call.Return(run) + return _c +} + +// Rename provides a mock function with given fields: from, to +func (_m *Schema) Rename(from string, to string) { + _m.Called(from, to) +} + +// Schema_Rename_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Rename' +type Schema_Rename_Call struct { + *mock.Call +} + +// Rename is a helper method to define mock.On call +// - from string +// - to string +func (_e *Schema_Expecter) Rename(from interface{}, to interface{}) *Schema_Rename_Call { + return &Schema_Rename_Call{Call: _e.mock.On("Rename", from, to)} +} + +func (_c *Schema_Rename_Call) Run(run func(from string, to string)) *Schema_Rename_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Schema_Rename_Call) Return() *Schema_Rename_Call { + _c.Call.Return() + return _c +} + +func (_c *Schema_Rename_Call) RunAndReturn(run func(string, string)) *Schema_Rename_Call { + _c.Call.Return(run) + return _c +} + +// Table provides a mock function with given fields: table, callback +func (_m *Schema) Table(table string, callback func(schema.Blueprint)) error { + ret := _m.Called(table, callback) + + if len(ret) == 0 { + panic("no return value specified for Table") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string, func(schema.Blueprint)) error); ok { + r0 = rf(table, callback) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Schema_Table_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Table' +type Schema_Table_Call struct { + *mock.Call +} + +// Table is a helper method to define mock.On call +// - table string +// - callback func(schema.Blueprint) +func (_e *Schema_Expecter) Table(table interface{}, callback interface{}) *Schema_Table_Call { + return &Schema_Table_Call{Call: _e.mock.On("Table", table, callback)} +} + +func (_c *Schema_Table_Call) Run(run func(table string, callback func(schema.Blueprint))) *Schema_Table_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(func(schema.Blueprint))) + }) + return _c +} + +func (_c *Schema_Table_Call) Return(_a0 error) *Schema_Table_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Schema_Table_Call) RunAndReturn(run func(string, func(schema.Blueprint)) error) *Schema_Table_Call { + _c.Call.Return(run) + return _c +} + +// NewSchema creates a new instance of Schema. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewSchema(t interface { + mock.TestingT + Cleanup(func()) +}) *Schema { + mock := &Schema{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/database/seeder/Facade.go b/mocks/database/seeder/Facade.go index 4152ac374..c88487cb1 100644 --- a/mocks/database/seeder/Facade.go +++ b/mocks/database/seeder/Facade.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/database/seeder/Seeder.go b/mocks/database/seeder/Seeder.go index 3ed1eace6..0ccef02ef 100644 --- a/mocks/database/seeder/Seeder.go +++ b/mocks/database/seeder/Seeder.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/event/Event.go b/mocks/event/Event.go index 6cc998422..88d7c58e2 100644 --- a/mocks/event/Event.go +++ b/mocks/event/Event.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/event/Instance.go b/mocks/event/Instance.go index 9dfd32344..901365318 100644 --- a/mocks/event/Instance.go +++ b/mocks/event/Instance.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/event/Listener.go b/mocks/event/Listener.go index dc20e6a6f..64efb010c 100644 --- a/mocks/event/Listener.go +++ b/mocks/event/Listener.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/event/Task.go b/mocks/event/Task.go index bf71134f1..859c8021b 100644 --- a/mocks/event/Task.go +++ b/mocks/event/Task.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/filesystem/Driver.go b/mocks/filesystem/Driver.go index 04a9b9399..cef36cd59 100644 --- a/mocks/filesystem/Driver.go +++ b/mocks/filesystem/Driver.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/filesystem/File.go b/mocks/filesystem/File.go index c6248a185..f08842242 100644 --- a/mocks/filesystem/File.go +++ b/mocks/filesystem/File.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/filesystem/Storage.go b/mocks/filesystem/Storage.go index 59f9e27fb..6372d77fa 100644 --- a/mocks/filesystem/Storage.go +++ b/mocks/filesystem/Storage.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/foundation/Application.go b/mocks/foundation/Application.go index 4f40972d3..ac51f706c 100644 --- a/mocks/foundation/Application.go +++ b/mocks/foundation/Application.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks @@ -42,6 +42,8 @@ import ( schedule "github.com/goravel/framework/contracts/schedule" + schema "github.com/goravel/framework/contracts/database/schema" + seeder "github.com/goravel/framework/contracts/database/seeder" session "github.com/goravel/framework/contracts/session" @@ -1369,6 +1371,53 @@ func (_c *Application_MakeSchedule_Call) RunAndReturn(run func() schedule.Schedu return _c } +// MakeSchema provides a mock function with given fields: +func (_m *Application) MakeSchema() schema.Schema { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for MakeSchema") + } + + var r0 schema.Schema + if rf, ok := ret.Get(0).(func() schema.Schema); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.Schema) + } + } + + return r0 +} + +// Application_MakeSchema_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MakeSchema' +type Application_MakeSchema_Call struct { + *mock.Call +} + +// MakeSchema is a helper method to define mock.On call +func (_e *Application_Expecter) MakeSchema() *Application_MakeSchema_Call { + return &Application_MakeSchema_Call{Call: _e.mock.On("MakeSchema")} +} + +func (_c *Application_MakeSchema_Call) Run(run func()) *Application_MakeSchema_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Application_MakeSchema_Call) Return(_a0 schema.Schema) *Application_MakeSchema_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Application_MakeSchema_Call) RunAndReturn(run func() schema.Schema) *Application_MakeSchema_Call { + _c.Call.Return(run) + return _c +} + // MakeSeeder provides a mock function with given fields: func (_m *Application) MakeSeeder() seeder.Facade { ret := _m.Called() diff --git a/mocks/foundation/Container.go b/mocks/foundation/Container.go index 98323d115..c0b20da4e 100644 --- a/mocks/foundation/Container.go +++ b/mocks/foundation/Container.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks @@ -42,6 +42,8 @@ import ( schedule "github.com/goravel/framework/contracts/schedule" + schema "github.com/goravel/framework/contracts/database/schema" + seeder "github.com/goravel/framework/contracts/database/seeder" session "github.com/goravel/framework/contracts/session" @@ -1027,6 +1029,53 @@ func (_c *Container_MakeSchedule_Call) RunAndReturn(run func() schedule.Schedule return _c } +// MakeSchema provides a mock function with given fields: +func (_m *Container) MakeSchema() schema.Schema { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for MakeSchema") + } + + var r0 schema.Schema + if rf, ok := ret.Get(0).(func() schema.Schema); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(schema.Schema) + } + } + + return r0 +} + +// Container_MakeSchema_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MakeSchema' +type Container_MakeSchema_Call struct { + *mock.Call +} + +// MakeSchema is a helper method to define mock.On call +func (_e *Container_Expecter) MakeSchema() *Container_MakeSchema_Call { + return &Container_MakeSchema_Call{Call: _e.mock.On("MakeSchema")} +} + +func (_c *Container_MakeSchema_Call) Run(run func()) *Container_MakeSchema_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Container_MakeSchema_Call) Return(_a0 schema.Schema) *Container_MakeSchema_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Container_MakeSchema_Call) RunAndReturn(run func() schema.Schema) *Container_MakeSchema_Call { + _c.Call.Return(run) + return _c +} + // MakeSeeder provides a mock function with given fields: func (_m *Container) MakeSeeder() seeder.Facade { ret := _m.Called() diff --git a/mocks/foundation/ServiceProvider.go b/mocks/foundation/ServiceProvider.go index 2e1f0cb6e..e3de617cc 100644 --- a/mocks/foundation/ServiceProvider.go +++ b/mocks/foundation/ServiceProvider.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/grpc/Grpc.go b/mocks/grpc/Grpc.go index b397174d9..226949d05 100644 --- a/mocks/grpc/Grpc.go +++ b/mocks/grpc/Grpc.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/hash/Hash.go b/mocks/hash/Hash.go index 5365e97a4..aaf5c9e80 100644 --- a/mocks/hash/Hash.go +++ b/mocks/hash/Hash.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/Context.go b/mocks/http/Context.go index f4cc357fc..17b0f1197 100644 --- a/mocks/http/Context.go +++ b/mocks/http/Context.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/ContextRequest.go b/mocks/http/ContextRequest.go index 07fc8ce62..ccb1e0e80 100644 --- a/mocks/http/ContextRequest.go +++ b/mocks/http/ContextRequest.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/ContextResponse.go b/mocks/http/ContextResponse.go index 8b27d4adc..609e4e067 100644 --- a/mocks/http/ContextResponse.go +++ b/mocks/http/ContextResponse.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/FormRequest.go b/mocks/http/FormRequest.go index 7afbf2f12..aa0943a6b 100644 --- a/mocks/http/FormRequest.go +++ b/mocks/http/FormRequest.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/HandlerFunc.go b/mocks/http/HandlerFunc.go index ceed09e17..b48ef4474 100644 --- a/mocks/http/HandlerFunc.go +++ b/mocks/http/HandlerFunc.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/Limit.go b/mocks/http/Limit.go index 27d36336b..a31532a9a 100644 --- a/mocks/http/Limit.go +++ b/mocks/http/Limit.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/Middleware.go b/mocks/http/Middleware.go index 9731ddd37..4cbb3b688 100644 --- a/mocks/http/Middleware.go +++ b/mocks/http/Middleware.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/RateLimiter.go b/mocks/http/RateLimiter.go index 6d82524a0..62b01c1a6 100644 --- a/mocks/http/RateLimiter.go +++ b/mocks/http/RateLimiter.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/ResourceController.go b/mocks/http/ResourceController.go index 6c34b79c0..2d9913e65 100644 --- a/mocks/http/ResourceController.go +++ b/mocks/http/ResourceController.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/Response.go b/mocks/http/Response.go index bd249ca1f..ae4382058 100644 --- a/mocks/http/Response.go +++ b/mocks/http/Response.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/ResponseOrigin.go b/mocks/http/ResponseOrigin.go index ff4c9d739..6c9fdefdb 100644 --- a/mocks/http/ResponseOrigin.go +++ b/mocks/http/ResponseOrigin.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/ResponseStatus.go b/mocks/http/ResponseStatus.go index 4d7dc7ce5..701440fa4 100644 --- a/mocks/http/ResponseStatus.go +++ b/mocks/http/ResponseStatus.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/ResponseSuccess.go b/mocks/http/ResponseSuccess.go index 47c943eba..4c44e5cdb 100644 --- a/mocks/http/ResponseSuccess.go +++ b/mocks/http/ResponseSuccess.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/ResponseView.go b/mocks/http/ResponseView.go index b8f6fea68..b9a0ef3ae 100644 --- a/mocks/http/ResponseView.go +++ b/mocks/http/ResponseView.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/http/View.go b/mocks/http/View.go index 1a166cac2..5d3d941c5 100644 --- a/mocks/http/View.go +++ b/mocks/http/View.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/log/Entry.go b/mocks/log/Entry.go index 76805b369..8ce8bb9f5 100644 --- a/mocks/log/Entry.go +++ b/mocks/log/Entry.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/log/Hook.go b/mocks/log/Hook.go index f1c4e5ea3..83c5d435a 100644 --- a/mocks/log/Hook.go +++ b/mocks/log/Hook.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/log/Log.go b/mocks/log/Log.go index 6870f994e..054427d7c 100644 --- a/mocks/log/Log.go +++ b/mocks/log/Log.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/log/Logger.go b/mocks/log/Logger.go index e22933978..57cf5e9c0 100644 --- a/mocks/log/Logger.go +++ b/mocks/log/Logger.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/log/Writer.go b/mocks/log/Writer.go index 43985a737..190bf0535 100644 --- a/mocks/log/Writer.go +++ b/mocks/log/Writer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/mail/Mail.go b/mocks/mail/Mail.go index 4a801a3ff..7b94c8d2c 100644 --- a/mocks/mail/Mail.go +++ b/mocks/mail/Mail.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/queue/Job.go b/mocks/queue/Job.go index c229ea509..cefca1554 100644 --- a/mocks/queue/Job.go +++ b/mocks/queue/Job.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/queue/Queue.go b/mocks/queue/Queue.go index cf8673f57..96e08562d 100644 --- a/mocks/queue/Queue.go +++ b/mocks/queue/Queue.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/queue/Task.go b/mocks/queue/Task.go index 0ad1ff59b..cd7f952f9 100644 --- a/mocks/queue/Task.go +++ b/mocks/queue/Task.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/queue/Worker.go b/mocks/queue/Worker.go index 00bd1fc3d..363f2bf35 100644 --- a/mocks/queue/Worker.go +++ b/mocks/queue/Worker.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/route/GroupFunc.go b/mocks/route/GroupFunc.go index 8efca1a0a..ad1727d39 100644 --- a/mocks/route/GroupFunc.go +++ b/mocks/route/GroupFunc.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/route/Route.go b/mocks/route/Route.go index dcd182f86..c9ba6ba7f 100644 --- a/mocks/route/Route.go +++ b/mocks/route/Route.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/route/Router.go b/mocks/route/Router.go index 9884f3d3e..f16623d21 100644 --- a/mocks/route/Router.go +++ b/mocks/route/Router.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/schedule/Event.go b/mocks/schedule/Event.go index 543ba7907..94cf5cef6 100644 --- a/mocks/schedule/Event.go +++ b/mocks/schedule/Event.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/schedule/Schedule.go b/mocks/schedule/Schedule.go index 71124387d..5fff9ddbe 100644 --- a/mocks/schedule/Schedule.go +++ b/mocks/schedule/Schedule.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/session/Driver.go b/mocks/session/Driver.go index 5ff5d87f6..913c72438 100644 --- a/mocks/session/Driver.go +++ b/mocks/session/Driver.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/session/Manager.go b/mocks/session/Manager.go index f94872b0e..49ecfbac8 100644 --- a/mocks/session/Manager.go +++ b/mocks/session/Manager.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/testing/Database.go b/mocks/testing/Database.go index ae64bbbed..44dc13564 100644 --- a/mocks/testing/Database.go +++ b/mocks/testing/Database.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/testing/DatabaseDriver.go b/mocks/testing/DatabaseDriver.go index 7f3fd2c3a..065036cbb 100644 --- a/mocks/testing/DatabaseDriver.go +++ b/mocks/testing/DatabaseDriver.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/testing/Docker.go b/mocks/testing/Docker.go index f6089aa87..04a4eb68d 100644 --- a/mocks/testing/Docker.go +++ b/mocks/testing/Docker.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/testing/Testing.go b/mocks/testing/Testing.go index a5863287a..48ca39c43 100644 --- a/mocks/testing/Testing.go +++ b/mocks/testing/Testing.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/translation/Loader.go b/mocks/translation/Loader.go index 4f554fbfc..3c27c29f6 100644 --- a/mocks/translation/Loader.go +++ b/mocks/translation/Loader.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/translation/Translator.go b/mocks/translation/Translator.go index 9a62558e3..d64bd8e07 100644 --- a/mocks/translation/Translator.go +++ b/mocks/translation/Translator.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/validation/Data.go b/mocks/validation/Data.go index 898bf2cce..ccae4643f 100644 --- a/mocks/validation/Data.go +++ b/mocks/validation/Data.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/validation/Errors.go b/mocks/validation/Errors.go index a85112ab5..77e6b284e 100644 --- a/mocks/validation/Errors.go +++ b/mocks/validation/Errors.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/validation/Option.go b/mocks/validation/Option.go index 144ae2de2..5a0610546 100644 --- a/mocks/validation/Option.go +++ b/mocks/validation/Option.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/validation/Rule.go b/mocks/validation/Rule.go index aded9af0a..0b64e53e5 100644 --- a/mocks/validation/Rule.go +++ b/mocks/validation/Rule.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/validation/Validation.go b/mocks/validation/Validation.go index 3a63b1a4a..a38662458 100644 --- a/mocks/validation/Validation.go +++ b/mocks/validation/Validation.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/mocks/validation/Validator.go b/mocks/validation/Validator.go index 585d5e824..e1009efdd 100644 --- a/mocks/validation/Validator.go +++ b/mocks/validation/Validator.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.39.1. DO NOT EDIT. package mocks diff --git a/support/convert/pointer.go b/support/convert/pointer.go new file mode 100644 index 000000000..2e85a3dc7 --- /dev/null +++ b/support/convert/pointer.go @@ -0,0 +1,5 @@ +package convert + +func Pointer[T any](t T) *T { + return &t +} diff --git a/support/docker/database.go b/support/docker/database.go index 0569a81ff..4f801d317 100644 --- a/support/docker/database.go +++ b/support/docker/database.go @@ -7,78 +7,78 @@ const ( ) type Database struct { - Mysql *Mysql - Mysql1 *Mysql - Postgresql *Postgresql - Sqlserver *Sqlserver - Sqlite *Sqlite + Mysql *Mysql + Mysql1 *Mysql + Postgres *Postgres + Sqlserver *Sqlserver + Sqlite *Sqlite } func InitDatabase() (*Database, error) { - mysqlDocker := NewMysql(database, username, password) - if err := mysqlDocker.Build(); err != nil { - return nil, err - } - - mysql1Docker := NewMysql(database, username, password) - if err := mysql1Docker.Build(); err != nil { - return nil, err - } + //mysqlDocker := NewMysql(database, username, password) + //if err := mysqlDocker.Build(); err != nil { + // return nil, err + //} + // + //mysql1Docker := NewMysql(database, username, password) + //if err := mysql1Docker.Build(); err != nil { + // return nil, err + //} - postgresqlDocker := NewPostgresql(database, username, password) + postgresqlDocker := NewPostgres(database, username, password) if err := postgresqlDocker.Build(); err != nil { return nil, err } - sqlserverDocker := NewSqlserver(database, username, password) - if err := sqlserverDocker.Build(); err != nil { - return nil, err - } - - sqliteDocker := NewSqlite(database) - if err := sqliteDocker.Build(); err != nil { - return nil, err - } + //sqlserverDocker := NewSqlserver(database, username, password) + //if err := sqlserverDocker.Build(); err != nil { + // return nil, err + //} + // + //sqliteDocker := NewSqlite(database) + //if err := sqliteDocker.Build(); err != nil { + // return nil, err + //} return &Database{ - Mysql: mysqlDocker, - Mysql1: mysql1Docker, - Postgresql: postgresqlDocker, - Sqlserver: sqlserverDocker, - Sqlite: sqliteDocker, + //Mysql: mysqlDocker, + //Mysql1: mysql1Docker, + Postgres: postgresqlDocker, + //Sqlserver: sqlserverDocker, + //Sqlite: sqliteDocker, }, nil } func (r *Database) Fresh() error { - if err := r.Mysql.Fresh(); err != nil { - return err - } - if err := r.Postgresql.Fresh(); err != nil { - return err - } - if err := r.Sqlserver.Fresh(); err != nil { - return err - } - if err := r.Sqlite.Fresh(); err != nil { + //if err := r.Mysql.Fresh(); err != nil { + // return err + //} + if err := r.Postgres.Fresh(); err != nil { return err } + //if err := r.Sqlserver.Fresh(); err != nil { + // return err + //} + //if err := r.Sqlite.Fresh(); err != nil { + // return err + //} return nil } func (r *Database) Stop() error { - if err := r.Mysql.Stop(); err != nil { - return err - } - if err := r.Postgresql.Stop(); err != nil { - return err - } - if err := r.Sqlserver.Stop(); err != nil { - return err - } - if err := r.Sqlite.Stop(); err != nil { + //if err := r.Mysql.Stop(); err != nil { + // return err + //} + if err := r.Postgres.Stop(); err != nil { return err } + //if err := r.Sqlserver.Stop(); err != nil { + // return err + //} + //if err := r.Sqlite.Stop(); err != nil { + // return err + //} return nil } diff --git a/support/docker/database_test.go b/support/docker/database_test.go index 4abc915bc..d66fc6d90 100644 --- a/support/docker/database_test.go +++ b/support/docker/database_test.go @@ -17,14 +17,14 @@ func TestInitDatabase(t *testing.T) { assert.Nil(t, err) assert.NotNil(t, database1) assert.True(t, database1.Mysql.Config().Port > 0) - assert.True(t, database1.Postgresql.Config().Port > 0) + assert.True(t, database1.Postgres.Config().Port > 0) assert.True(t, database1.Sqlserver.Config().Port > 0) database2, err := InitDatabase() assert.Nil(t, err) assert.NotNil(t, database2) assert.True(t, database2.Mysql.Config().Port > 0) - assert.True(t, database2.Postgresql.Config().Port > 0) + assert.True(t, database2.Postgres.Config().Port > 0) assert.True(t, database2.Sqlserver.Config().Port > 0) assert.Nil(t, database1.Fresh()) diff --git a/support/docker/postgresql.go b/support/docker/postgres.go similarity index 77% rename from support/docker/postgresql.go rename to support/docker/postgres.go index 70459ec1d..5e57252a6 100644 --- a/support/docker/postgresql.go +++ b/support/docker/postgres.go @@ -11,7 +11,7 @@ import ( "github.com/goravel/framework/contracts/testing" ) -type Postgresql struct { +type Postgres struct { containerID string database string host string @@ -21,8 +21,8 @@ type Postgresql struct { port int } -func NewPostgresql(database, username, password string) *Postgresql { - return &Postgresql{ +func NewPostgres(database, username, password string) *Postgres { + return &Postgres{ database: database, host: "127.0.0.1", username: username, @@ -40,27 +40,27 @@ func NewPostgresql(database, username, password string) *Postgresql { } } -func (receiver *Postgresql) Build() error { +func (receiver *Postgres) Build() error { command, exposedPorts := imageToCommand(receiver.image) containerID, err := run(command) if err != nil { - return fmt.Errorf("init Postgresql error: %v", err) + return fmt.Errorf("init Postgres error: %v", err) } if containerID == "" { - return fmt.Errorf("no container id return when creating Postgresql docker") + return fmt.Errorf("no container id return when creating Postgres docker") } receiver.containerID = containerID receiver.port = getExposedPort(exposedPorts, 5432) if _, err := receiver.connect(); err != nil { - return fmt.Errorf("connect Postgresql error: %v", err) + return fmt.Errorf("connect Postgres error: %v", err) } return nil } -func (receiver *Postgresql) Config() testing.DatabaseConfig { +func (receiver *Postgres) Config() testing.DatabaseConfig { return testing.DatabaseConfig{ Host: receiver.host, Port: receiver.port, @@ -70,7 +70,7 @@ func (receiver *Postgresql) Config() testing.DatabaseConfig { } } -func (receiver *Postgresql) Fresh() error { +func (receiver *Postgres) Fresh() error { instance, err := receiver.connect() if err != nil { return fmt.Errorf("connect Postgres error when clearing: %v", err) @@ -87,23 +87,23 @@ func (receiver *Postgresql) Fresh() error { return nil } -func (receiver *Postgresql) Image(image testing.Image) { +func (receiver *Postgres) Image(image testing.Image) { receiver.image = &image } -func (receiver *Postgresql) Name() orm.Driver { +func (receiver *Postgres) Name() orm.Driver { return orm.DriverPostgresql } -func (receiver *Postgresql) Stop() error { +func (receiver *Postgres) Stop() error { if _, err := run(fmt.Sprintf("docker stop %s", receiver.containerID)); err != nil { - return fmt.Errorf("stop Postgresql error: %v", err) + return fmt.Errorf("stop Postgres error: %v", err) } return nil } -func (receiver *Postgresql) connect() (*gormio.DB, error) { +func (receiver *Postgres) connect() (*gormio.DB, error) { var ( instance *gormio.DB err error diff --git a/support/docker/postgresql_test.go b/support/docker/postgres_test.go similarity index 95% rename from support/docker/postgresql_test.go rename to support/docker/postgres_test.go index 6ab0e3214..e5af948d4 100644 --- a/support/docker/postgresql_test.go +++ b/support/docker/postgres_test.go @@ -14,7 +14,7 @@ import ( type PostgresqlTestSuite struct { suite.Suite mockConfig *configmocks.Config - postgresql *Postgresql + postgresql *Postgres } func TestPostgresqlTestSuite(t *testing.T) { @@ -27,7 +27,7 @@ func TestPostgresqlTestSuite(t *testing.T) { func (s *PostgresqlTestSuite) SetupTest() { s.mockConfig = &configmocks.Config{} - s.postgresql = NewPostgresql("goravel", "goravel", "goravel") + s.postgresql = NewPostgres("goravel", "goravel", "goravel") } func (s *PostgresqlTestSuite) TestBuild() { diff --git a/testing/docker/database.go b/testing/docker/database.go index cf55e0a6b..cd319f41a 100644 --- a/testing/docker/database.go +++ b/testing/docker/database.go @@ -40,7 +40,7 @@ func NewDatabase(app foundation.Application, connection string, gormInitialize g case contractsorm.DriverMysql: databaseDriver = supportdocker.NewMysql(database, username, password) case contractsorm.DriverPostgresql: - databaseDriver = supportdocker.NewPostgresql(database, username, password) + databaseDriver = supportdocker.NewPostgres(database, username, password) case contractsorm.DriverSqlserver: databaseDriver = supportdocker.NewSqlserver(database, username, password) case contractsorm.DriverSqlite: diff --git a/testing/docker/database_test.go b/testing/docker/database_test.go index f454bad31..2860c3cf0 100644 --- a/testing/docker/database_test.go +++ b/testing/docker/database_test.go @@ -97,7 +97,7 @@ func TestNewDatabase(t *testing.T) { app: mockApp, config: mockConfig, connection: "postgresql", - driver: supportdocker.NewPostgresql(database, username, password), + driver: supportdocker.NewPostgres(database, username, password), gormInitialize: mockGormInitialize, } },