Documentation ¶
Index ¶
- Variables
- type LegacyPerson
- func (s *LegacyPerson) HasPK() bool
- func (s *LegacyPerson) PKPointer() interface{}
- func (s *LegacyPerson) PKValue() interface{}
- func (s *LegacyPerson) Pointers() []interface{}
- func (s *LegacyPerson) SetPK(pk interface{})
- func (s LegacyPerson) String() string
- func (s *LegacyPerson) Table() reform.Table
- func (s *LegacyPerson) Values() []interface{}
- func (s *LegacyPerson) View() reform.View
- type Person
- func (p *Person) AfterFind() error
- func (p *Person) BeforeInsert() error
- func (p *Person) BeforeUpdate() error
- func (s *Person) HasPK() bool
- func (s *Person) PKPointer() interface{}
- func (s *Person) PKValue() interface{}
- func (s *Person) Pointers() []interface{}
- func (s *Person) SetPK(pk interface{})
- func (s Person) String() string
- func (s *Person) Table() reform.Table
- func (s *Person) Values() []interface{}
- func (s *Person) View() reform.View
- type PersonProject
- type Project
- func (p *Project) AfterFind() error
- func (p *Project) BeforeInsert() error
- func (p *Project) BeforeUpdate() error
- func (s *Project) HasPK() bool
- func (s *Project) PKPointer() interface{}
- func (s *Project) PKValue() interface{}
- func (s *Project) Pointers() []interface{}
- func (s *Project) SetPK(pk interface{})
- func (s Project) String() string
- func (s *Project) Table() reform.Table
- func (s *Project) Values() []interface{}
- func (s *Project) View() reform.View
Constants ¶
This section is empty.
Variables ¶
var LegacyPersonTable = &legacyPersonTable{ s: parse.StructInfo{Type: "LegacyPerson", SQLSchema: "legacy", SQLName: "people", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "Name", Type: "*string", Column: "name"}}, PKFieldIndex: 0}, z: new(LegacyPerson).Values(), }
LegacyPersonTable represents people view or table in SQL database.
var PersonProjectView = &personProjectView{ s: parse.StructInfo{Type: "PersonProject", SQLSchema: "", SQLName: "person_project", Fields: []parse.FieldInfo{{Name: "PersonID", Type: "int32", Column: "person_id"}, {Name: "ProjectID", Type: "string", Column: "project_id"}}, PKFieldIndex: -1}, z: new(PersonProject).Values(), }
PersonProjectView represents person_project view or table in SQL database.
var PersonTable = &personTable{ s: parse.StructInfo{Type: "Person", SQLSchema: "", SQLName: "people", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "Name", Type: "string", Column: "name"}, {Name: "Email", Type: "*string", Column: "email"}, {Name: "CreatedAt", Type: "time.Time", Column: "created_at"}, {Name: "UpdatedAt", Type: "*time.Time", Column: "updated_at"}}, PKFieldIndex: 0}, z: new(Person).Values(), }
PersonTable represents people view or table in SQL database.
var ProjectTable = &projectTable{ s: parse.StructInfo{Type: "Project", SQLSchema: "", SQLName: "projects", Fields: []parse.FieldInfo{{Name: "Name", Type: "string", Column: "name"}, {Name: "ID", Type: "string", Column: "id"}, {Name: "Start", Type: "time.Time", Column: "start"}, {Name: "End", Type: "*time.Time", Column: "end"}}, PKFieldIndex: 1}, z: new(Project).Values(), }
ProjectTable represents projects view or table in SQL database.
Functions ¶
This section is empty.
Types ¶
type LegacyPerson ¶
func (*LegacyPerson) HasPK ¶
func (s *LegacyPerson) HasPK() bool
HasPK returns true if record has non-zero primary key set, false otherwise.
func (*LegacyPerson) PKPointer ¶
func (s *LegacyPerson) PKPointer() interface{}
PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.
func (*LegacyPerson) PKValue ¶
func (s *LegacyPerson) PKValue() interface{}
PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.
func (*LegacyPerson) Pointers ¶
func (s *LegacyPerson) Pointers() []interface{}
Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.
func (*LegacyPerson) SetPK ¶
func (s *LegacyPerson) SetPK(pk interface{})
SetPK sets record primary key.
func (LegacyPerson) String ¶
func (s LegacyPerson) String() string
String returns a string representation of this struct or record.
func (*LegacyPerson) Table ¶
func (s *LegacyPerson) Table() reform.Table
Table returns Table object for that record.
func (*LegacyPerson) Values ¶
func (s *LegacyPerson) Values() []interface{}
Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.
func (*LegacyPerson) View ¶
func (s *LegacyPerson) View() reform.View
View returns View object for that struct.
type Person ¶
type Person struct { ID int32 `reform:"id,pk"` Name string `reform:"name"` Email *string `reform:"email"` CreatedAt time.Time `reform:"created_at"` UpdatedAt *time.Time `reform:"updated_at"` }
func (*Person) AfterFind ¶
AfterFind converts to UTC and truncates to second both CreatedAt and UpdatedAt.
func (*Person) BeforeInsert ¶
BeforeInsert sets CreatedAt if it's not set, then converts to UTC and truncates to second both CreatedAt and UpdatedAt.
func (*Person) BeforeUpdate ¶
BeforeUpdate sets CreatedAt if it's not set, sets UpdatedAt, then converts to UTC and truncates to second both CreatedAt and UpdatedAt.
func (*Person) PKPointer ¶
func (s *Person) PKPointer() interface{}
PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.
func (*Person) PKValue ¶
func (s *Person) PKValue() interface{}
PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.
func (*Person) Pointers ¶
func (s *Person) Pointers() []interface{}
Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.
func (*Person) Table ¶
func (s *Person) Table() reform.Table
Table returns Table object for that record.
type PersonProject ¶
type PersonProject struct { PersonID int32 `reform:"person_id"` ProjectID string `reform:"project_id"` }
PersonProject represents row in table person_project. reform:person_project
func (*PersonProject) Pointers ¶
func (s *PersonProject) Pointers() []interface{}
Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.
func (PersonProject) String ¶
func (s PersonProject) String() string
String returns a string representation of this struct or record.
func (*PersonProject) Values ¶
func (s *PersonProject) Values() []interface{}
Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.
func (*PersonProject) View ¶
func (s *PersonProject) View() reform.View
View returns View object for that struct.
type Project ¶
type Project struct { Name string `reform:"name"` ID string `reform:"id,pk"` Start time.Time `reform:"start"` End *time.Time `reform:"end"` }
Project represents row in table projects (reform:projects).
func (*Project) BeforeInsert ¶
BeforeInsert converts to UTC and truncates to day both Start and End.
func (*Project) BeforeUpdate ¶
BeforeUpdate converts to UTC and truncates to day both Start and End.
func (*Project) PKPointer ¶
func (s *Project) PKPointer() interface{}
PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.
func (*Project) PKValue ¶
func (s *Project) PKValue() interface{}
PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.
func (*Project) Pointers ¶
func (s *Project) Pointers() []interface{}
Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.
func (*Project) Table ¶
func (s *Project) Table() reform.Table
Table returns Table object for that record.