models

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExtraTable = &extraTable{
	s: parse.StructInfo{Type: "Extra", SQLSchema: "", SQLName: "extra", Fields: []parse.FieldInfo{{Name: "ID", PKType: "Integer", Column: "id"}, {Name: "Name", PKType: "", Column: "name"}, {Name: "Bytes", PKType: "", Column: "bytes"}, {Name: "Bytes2", PKType: "", Column: "bytes2"}, {Name: "Byte", PKType: "", Column: "byte"}, {Name: "Array", PKType: "", Column: "array"}}, PKFieldIndex: 0},
	z: new(Extra).Values(),
}

ExtraTable represents extra view or table in SQL database.

View Source
var LegacyPersonTable = &legacyPersonTable{
	s: parse.StructInfo{Type: "LegacyPerson", SQLSchema: "legacy", SQLName: "people", Fields: []parse.FieldInfo{{Name: "ID", PKType: "int32", Column: "id"}, {Name: "Name", PKType: "", Column: "name"}}, PKFieldIndex: 0},
	z: new(LegacyPerson).Values(),
}

LegacyPersonTable represents people view or table in SQL database.

View Source
var PersonProjectView = &personProjectView{
	s: parse.StructInfo{Type: "PersonProject", SQLSchema: "", SQLName: "person_project", Fields: []parse.FieldInfo{{Name: "PersonID", PKType: "", Column: "person_id"}, {Name: "ProjectID", PKType: "", Column: "project_id"}}, PKFieldIndex: -1},
	z: new(PersonProject).Values(),
}

PersonProjectView represents person_project view or table in SQL database.

View Source
var PersonTable = &personTable{
	s: parse.StructInfo{Type: "Person", SQLSchema: "", SQLName: "people", Fields: []parse.FieldInfo{{Name: "ID", PKType: "int32", Column: "id"}, {Name: "Name", PKType: "", Column: "name"}, {Name: "Email", PKType: "", Column: "email"}, {Name: "CreatedAt", PKType: "", Column: "created_at"}, {Name: "UpdatedAt", PKType: "", Column: "updated_at"}}, PKFieldIndex: 0},
	z: new(Person).Values(),
}

PersonTable represents people view or table in SQL database.

View Source
var ProjectTable = &projectTable{
	s: parse.StructInfo{Type: "Project", SQLSchema: "", SQLName: "projects", Fields: []parse.FieldInfo{{Name: "Name", PKType: "", Column: "name"}, {Name: "ID", PKType: "string", Column: "id"}, {Name: "Start", PKType: "", Column: "start"}, {Name: "End", PKType: "", Column: "end"}}, PKFieldIndex: 1},
	z: new(Project).Values(),
}

ProjectTable represents projects view or table in SQL database.

Functions

This section is empty.

Types

type Bytes added in v1.1.2

type Bytes []byte

type Extra added in v1.1.1

type Extra struct {
	ID     Integer   `reform:"id,pk"`
	Name   *String   `reform:"name"`
	Bytes  []byte    `reform:"bytes"`
	Bytes2 Bytes     `reform:"bytes2"`
	Byte   *byte     `reform:"byte"`
	Array  [512]byte `reform:"array"`
}

func (*Extra) HasPK added in v1.1.1

func (s *Extra) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*Extra) PKPointer added in v1.1.1

func (s *Extra) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*Extra) PKValue added in v1.1.1

func (s *Extra) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*Extra) Pointers added in v1.1.1

func (s *Extra) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*Extra) SetPK added in v1.1.1

func (s *Extra) SetPK(pk interface{})

SetPK sets record primary key.

func (Extra) String added in v1.1.1

func (s Extra) String() string

String returns a string representation of this struct or record.

func (*Extra) Table added in v1.1.1

func (s *Extra) Table() reform.Table

Table returns Table object for that record.

func (*Extra) Values added in v1.1.1

func (s *Extra) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Extra) View added in v1.1.1

func (s *Extra) View() reform.View

View returns View object for that struct.

type Integer added in v1.1.1

type Integer int32

type LegacyPerson

type LegacyPerson struct {
	ID   int32   `reform:"id,pk"`
	Name *string `reform:"name"`
}

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

func (p *Person) AfterFind() error

AfterFind converts to UTC and truncates to second both CreatedAt and UpdatedAt.

func (*Person) BeforeInsert

func (p *Person) BeforeInsert() error

BeforeInsert sets CreatedAt if it's not set, then converts to UTC and truncates to second both CreatedAt and UpdatedAt.

func (*Person) BeforeUpdate

func (p *Person) BeforeUpdate() error

BeforeUpdate sets CreatedAt if it's not set, sets UpdatedAt, then converts to UTC and truncates to second both CreatedAt and UpdatedAt.

func (*Person) HasPK

func (s *Person) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

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) SetPK

func (s *Person) SetPK(pk interface{})

SetPK sets record primary key.

func (Person) String

func (s Person) String() string

String returns a string representation of this struct or record.

func (*Person) Table

func (s *Person) Table() reform.Table

Table returns Table object for that record.

func (*Person) Values

func (s *Person) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Person) View

func (s *Person) View() reform.View

View returns View object for that struct.

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) AfterFind

func (p *Project) AfterFind() error

AfterFind converts to UTC both Start and End.

func (*Project) BeforeInsert

func (p *Project) BeforeInsert() error

BeforeInsert converts to UTC and truncates to day both Start and End.

func (*Project) BeforeUpdate

func (p *Project) BeforeUpdate() error

BeforeUpdate converts to UTC and truncates to day both Start and End.

func (*Project) HasPK

func (s *Project) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

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) SetPK

func (s *Project) SetPK(pk interface{})

SetPK sets record primary key.

func (Project) String

func (s Project) String() string

String returns a string representation of this struct or record.

func (*Project) Table

func (s *Project) Table() reform.Table

Table returns Table object for that record.

func (*Project) Values

func (s *Project) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Project) View

func (s *Project) View() reform.View

View returns View object for that struct.

type String added in v1.1.1

type String string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL