Help us shape the future of Go! Take the 2026 Go Developer Survey

models

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExtraTable = &extraTableType{
	s: parse.StructInfo{Type: "Extra", SQLSchema: "", SQLName: "extra", Fields: []parse.FieldInfo{{Name: "ID", Type: "Integer", Column: "id"}, {Name: "Name", Type: "*String", Column: "name"}, {Name: "Byte", Type: "uint8", Column: "byte"}, {Name: "Uint8", Type: "uint8", Column: "uint8"}, {Name: "ByteP", Type: "*uint8", Column: "bytep"}, {Name: "Uint8P", Type: "*uint8", Column: "uint8p"}, {Name: "Bytes", Type: "[]uint8", Column: "bytes"}, {Name: "Uint8s", Type: "[]uint8", Column: "uint8s"}, {Name: "BytesA", Type: "[512]uint8", Column: "bytesa"}, {Name: "Uint8sA", Type: "[512]uint8", Column: "uint8sa"}, {Name: "BytesT", Type: "Bytes", Column: "bytest"}, {Name: "Uint8sT", Type: "Uint8s", Column: "uint8st"}}, PKFieldIndex: 0},
	z: new(Extra).Values(),
}

ExtraTable represents extra view or table in SQL database.

View Source
var IDOnlyTable = &iDOnlyTableType{
	s: parse.StructInfo{Type: "IDOnly", SQLSchema: "", SQLName: "id_only", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}}, PKFieldIndex: 0},
	z: new(IDOnly).Values(),
}

IDOnlyTable represents id_only view or table in SQL database.

View Source
var LegacyPersonTable = &legacyPersonTableType{
	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.

View Source
var PersonProjectView = &personProjectViewType{
	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.

View Source
var PersonTable = &personTableType{
	s: parse.StructInfo{Type: "Person", SQLSchema: "", SQLName: "people", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "GroupID", Type: "*int32", Column: "group_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.

View Source
var ProjectTable = &projectTableType{
	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 Bytes added in v1.1.2

type Bytes []byte

types for testing

type Extra added in v1.1.1

type Extra struct {
	ID Integer `reform:"id,pk"`
	// UUID     uuid.UUID `reform:"uuid"`
	Name *String `reform:"name"`

	Ignored1 string
	Ignored2 string `reform:""`
	Ignored3 string `reform:"-"`

	Byte    byte       `reform:"byte"`
	Uint8   uint8      `reform:"uint8"`
	ByteP   *byte      `reform:"bytep"`
	Uint8P  *uint8     `reform:"uint8p"`
	Bytes   []byte     `reform:"bytes"`
	Uint8s  []uint8    `reform:"uint8s"`
	BytesA  [512]byte  `reform:"bytesa"`
	Uint8sA [512]uint8 `reform:"uint8sa"`
	BytesT  Bytes      `reform:"bytest"`
	Uint8sT Uint8s     `reform:"uint8st"`
}

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 IDOnly added in v1.2.0

type IDOnly struct {
	ID int32 `reform:"id,pk"`
}

reform:id_only

func (*IDOnly) HasPK added in v1.2.0

func (s *IDOnly) HasPK() bool

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

func (*IDOnly) PKPointer added in v1.2.0

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

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

func (*IDOnly) PKValue added in v1.2.0

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

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

func (*IDOnly) Pointers added in v1.2.0

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

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

func (*IDOnly) SetPK added in v1.2.0

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

SetPK sets record primary key.

func (IDOnly) String added in v1.2.0

func (s IDOnly) String() string

String returns a string representation of this struct or record.

func (*IDOnly) Table added in v1.2.0

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

Table returns Table object for that record.

func (*IDOnly) Values added in v1.2.0

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

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

func (*IDOnly) View added in v1.2.0

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

View returns View object for that struct.

type Integer added in v1.1.1

type Integer int32

types for testing

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"`
	GroupID   *int32     `reform:"group_id"`
	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, truncates to second and strips monotonic clock reading from 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, truncates to second and strips monotonic clock reading from 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, truncates to day and strips monotonic clock reading from both Start and End.

func (*Project) BeforeUpdate

func (p *Project) BeforeUpdate() error

BeforeUpdate converts to UTC, truncates to day and strips monotonic clock reading from 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

types for testing

type Uint8s added in v1.3.0

type Uint8s []uint8

types for testing

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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