Documentation
¶
Index ¶
- Variables
- func NewAuthAppConfig() django.AppConfig
- func NewBlogAppConfig() django.AppConfig
- func NewTodoAppConfig() django.AppConfig
- type Action
- type BlogComment
- type BlogPost
- type Profile
- type SQL
- type TestMigrationEngine
- func (t *TestMigrationEngine) AddField(table migrator.Table, col migrator.Column) error
- func (t *TestMigrationEngine) AddIndex(table migrator.Table, index migrator.Index) error
- func (t *TestMigrationEngine) AlterField(table migrator.Table, old migrator.Column, newCol migrator.Column) error
- func (t *TestMigrationEngine) CreateTable(table migrator.Table) error
- func (t *TestMigrationEngine) DropIndex(table migrator.Table, index migrator.Index) error
- func (t *TestMigrationEngine) DropTable(table migrator.Table) error
- func (t *TestMigrationEngine) Execute(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (t *TestMigrationEngine) HasMigration(appName string, modelName string, migrationName string) (bool, error)
- func (t *TestMigrationEngine) RemoveField(table migrator.Table, col migrator.Column) error
- func (t *TestMigrationEngine) RemoveMigration(appName string, modelName string, migrationName string) error
- func (t *TestMigrationEngine) RenameIndex(table migrator.Table, oldName string, newName string) error
- func (t *TestMigrationEngine) RenameTable(table migrator.Table, newName string) error
- func (t *TestMigrationEngine) Setup() error
- func (t *TestMigrationEngine) StoreMigration(appName string, modelName string, migrationName string) error
- type Todo
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ExtendedDefinitions = false ExtendedDefinitionsUser = false ExtendedDefinitionsTodo = false ExtendedDefinitionsProfile = false )
Functions ¶
func NewAuthAppConfig ¶
func NewBlogAppConfig ¶
func NewTodoAppConfig ¶
Types ¶
type BlogComment ¶
type BlogComment struct { ID int64 `attrs:"primary"` Body string `attrs:"max_length=255"` Author *User `attrs:"fk=test_sql.User;column=author_id"` Post *BlogPost `attrs:"fk=test_sql.BlogPost;column=post_id"` CreatedAt time.Time `attrs:"-"` UpdatedAt time.Time `attrs:"-"` }
func (*BlogComment) FieldDefs ¶
func (m *BlogComment) FieldDefs() attrs.Definitions
type BlogPost ¶
type BlogPost struct { ID int64 `attrs:"primary"` Title string `attrs:"max_length=255"` Body string `attrs:"max_length=255"` Author *User `attrs:"fk=test_sql.User;column=author_id"` Published bool `attrs:"-"` CreatedAt time.Time `attrs:"-"` UpdatedAt time.Time `attrs:"-"` }
func (*BlogPost) FieldDefs ¶
func (m *BlogPost) FieldDefs() attrs.Definitions
type Profile ¶
type Profile struct { ID int64 `attrs:"primary"` User *User `attrs:"o2o=test_sql.User;column=user_id"` Image string `attrs:"-"` Biography string `attrs:"-"` Website string `attrs:"-"` }
func (*Profile) FieldDefs ¶
func (m *Profile) FieldDefs() attrs.Definitions
type TestMigrationEngine ¶
type TestMigrationEngine struct { SetupCalled bool StoredMigrations map[string]map[string]map[string]struct{} RawSQL []SQL Actions []Action // contains filtered or unexported fields }
func NewTestMigrationEngine ¶
func NewTestMigrationEngine(t *testing.T) *TestMigrationEngine
func (*TestMigrationEngine) AddField ¶
func (t *TestMigrationEngine) AlterUniqueTogether(table migrator.Table, unique bool) error { t.Actions = append(t.Actions, Action{Type: migrator.ActionAlterUniqueTogether, Table: table}) return nil }
func (t *TestMigrationEngine) AlterIndexTogether(table migrator.Table, unique bool) error { t.Actions = append(t.Actions, Action{Type: migrator.ActionAlterIndexTogether, Table: table}) return nil }
func (*TestMigrationEngine) AlterField ¶
func (*TestMigrationEngine) CreateTable ¶
func (t *TestMigrationEngine) CreateTable(table migrator.Table) error
func (*TestMigrationEngine) DropTable ¶
func (t *TestMigrationEngine) DropTable(table migrator.Table) error
func (*TestMigrationEngine) HasMigration ¶
func (*TestMigrationEngine) RemoveField ¶
func (*TestMigrationEngine) RemoveMigration ¶
func (t *TestMigrationEngine) RemoveMigration(appName string, modelName string, migrationName string) error
func (*TestMigrationEngine) RenameIndex ¶
func (*TestMigrationEngine) RenameTable ¶
func (t *TestMigrationEngine) RenameTable(table migrator.Table, newName string) error
func (*TestMigrationEngine) Setup ¶
func (t *TestMigrationEngine) Setup() error
func (*TestMigrationEngine) StoreMigration ¶
func (t *TestMigrationEngine) StoreMigration(appName string, modelName string, migrationName string) error
type Todo ¶
type Todo struct { ID int64 `attrs:"primary"` Title string `attrs:"max_length=255"` Completed bool `attrs:"default=false"` User *User `attrs:"fk=test_sql.User;column=user_id"` Description string `attrs:"-"` CreatedAt time.Time `attrs:"-"` UpdatedAt time.Time `attrs:"-"` }
func (*Todo) FieldDefs ¶
func (m *Todo) FieldDefs() attrs.Definitions
type User ¶
type User struct { ID int64 `attrs:"primary"` Name string `attrs:"max_length=255"` Email string `attrs:"max_length=255"` Age int32 `attrs:"min_value=0;max_value=120"` IsActive bool `attrs:"-"` FirstName string `attrs:"-"` LastName string `attrs:"-"` }
func (*User) FieldDefs ¶
func (m *User) FieldDefs() attrs.Definitions
Click to show internal directories.
Click to hide internal directories.