Documentation ¶
Index ¶
- Constants
- Variables
- func CheckVolume(volume string) bool
- func GetVolumes() []string
- type Book
- func (b *Book) BeforeInsert() error
- func (b *Book) BeforeUpdate() error
- func (s *Book) HasPK() bool
- func (s *Book) PKPointer() interface{}
- func (s *Book) PKValue() interface{}
- func (s *Book) Pointers() []interface{}
- func (s *Book) SetPK(pk interface{})
- func (s Book) String() string
- func (s *Book) Table() reform.Table
- func (s *Book) Values() []interface{}
- func (s *Book) View() reform.View
- type BookBroken
- func (b *BookBroken) BeforeInsert() error
- func (b *BookBroken) BeforeUpdate() error
- func (s *BookBroken) HasPK() bool
- func (s *BookBroken) PKPointer() interface{}
- func (s *BookBroken) PKValue() interface{}
- func (s *BookBroken) Pointers() []interface{}
- func (s *BookBroken) SetPK(pk interface{})
- func (s BookBroken) String() string
- func (s *BookBroken) Table() reform.Table
- func (s *BookBroken) Values() []interface{}
- func (s *BookBroken) View() reform.View
- type Category
- func (c *Category) BeforeInsert() error
- func (c *Category) BeforeUpdate() error
- func (s *Category) HasPK() bool
- func (s *Category) PKPointer() interface{}
- func (s *Category) PKValue() interface{}
- func (s *Category) Pointers() []interface{}
- func (s *Category) SetPK(pk interface{})
- func (s Category) String() string
- func (s *Category) Table() reform.Table
- func (s *Category) Values() []interface{}
- func (s *Category) View() reform.View
- type Library
- func (l *Library) BeforeInsert() error
- func (l *Library) BeforeUpdate() error
- func (s *Library) HasPK() bool
- func (s *Library) PKPointer() interface{}
- func (s *Library) PKValue() interface{}
- func (s *Library) Pointers() []interface{}
- func (s *Library) SetPK(pk interface{})
- func (s Library) String() string
- func (s *Library) Table() reform.Table
- func (s *Library) Values() []interface{}
- func (s *Library) View() reform.View
- type User
- func (u *User) BeforeInsert() error
- func (u *User) BeforeUpdate() error
- func (s *User) HasPK() bool
- func (s *User) PKPointer() interface{}
- func (s *User) PKValue() interface{}
- func (s *User) Pointers() []interface{}
- func (s *User) SetPK(pk interface{})
- func (s User) String() string
- func (s *User) Table() reform.Table
- func (s *User) Values() []interface{}
- func (s *User) View() reform.View
- type Volume
- func (v *Volume) BeforeInsert() error
- func (v *Volume) BeforeUpdate() error
- func (s *Volume) HasPK() bool
- func (s *Volume) PKPointer() interface{}
- func (s *Volume) PKValue() interface{}
- func (s *Volume) Pointers() []interface{}
- func (s *Volume) SetPK(pk interface{})
- func (s Volume) String() string
- func (s *Volume) Table() reform.Table
- func (s *Volume) Values() []interface{}
- func (s *Volume) View() reform.View
Constants ¶
const ( VolumePaper = "paperbook" VolumeElectro = "ebook" VolumeAudio = "audiobook" )
List of possible "volumes" (book types)
Variables ¶
var BookBrokenTable = &bookBrokenTableType{ s: parse.StructInfo{Type: "BookBroken", SQLSchema: "", SQLName: "books_broken", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "URL", Type: "string", Column: "url"}, {Name: "CreatedAt", Type: "time.Time", Column: "created_at"}, {Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"}}, PKFieldIndex: 0}, z: new(BookBroken).Values(), }
BookBrokenTable represents books_broken view or table in SQL database.
var BookTable = &bookTableType{ s: parse.StructInfo{Type: "Book", SQLSchema: "", SQLName: "books", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "MIFID", Type: "*int32", Column: "mif_id"}, {Name: "CategoryID", Type: "*int32", Column: "category_id"}, {Name: "Title", Type: "*string", Column: "title"}, {Name: "ISBN", Type: "*string", Column: "isbn"}, {Name: "Authors", Type: "*string", Column: "authors"}, {Name: "URL", Type: "string", Column: "url"}, {Name: "CreatedAt", Type: "time.Time", Column: "created_at"}, {Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"}, {Name: "IsVisible", Type: "bool", Column: "is_visible"}}, PKFieldIndex: 0}, z: new(Book).Values(), }
BookTable represents books view or table in SQL database.
var CategoryTable = &categoryTableType{ s: parse.StructInfo{Type: "Category", SQLSchema: "", SQLName: "categories", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "Title", Type: "string", Column: "title"}, {Name: "CreatedAt", Type: "time.Time", Column: "created_at"}, {Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"}}, PKFieldIndex: 0}, z: new(Category).Values(), }
CategoryTable represents categories view or table in SQL database.
var LibraryTable = &libraryTableType{ s: parse.StructInfo{Type: "Library", SQLSchema: "", SQLName: "library", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "UserID", Type: "int32", Column: "user_id"}, {Name: "VolumeID", Type: "int32", Column: "volume_id"}, {Name: "CreatedAt", Type: "time.Time", Column: "created_at"}, {Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"}}, PKFieldIndex: 0}, z: new(Library).Values(), }
LibraryTable represents library view or table in SQL database.
var UserTable = &userTableType{ s: parse.StructInfo{Type: "User", SQLSchema: "", SQLName: "users", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "Email", Type: "string", Column: "email"}, {Name: "Token", Type: "string", Column: "token"}, {Name: "CreatedAt", Type: "time.Time", Column: "created_at"}, {Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"}}, PKFieldIndex: 0}, z: new(User).Values(), }
UserTable represents users view or table in SQL database.
var VolumeTable = &volumeTableType{ s: parse.StructInfo{Type: "Volume", SQLSchema: "", SQLName: "volumes", Fields: []parse.FieldInfo{{Name: "ID", Type: "int32", Column: "id"}, {Name: "BookID", Type: "int32", Column: "book_id"}, {Name: "Type", Type: "string", Column: "type"}, {Name: "CreatedAt", Type: "time.Time", Column: "created_at"}, {Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"}}, PKFieldIndex: 0}, z: new(Volume).Values(), }
VolumeTable represents volumes view or table in SQL database.
Functions ¶
func CheckVolume ¶
CheckVolume checks if the given volume is supported
func GetVolumes ¶
func GetVolumes() []string
GetVolumes returns list of possible "volumes" (book types)
Types ¶
type Book ¶
type Book struct { ID int32 `reform:"id,pk" json:"id"` MIFID *int32 `reform:"mif_id" json:"mif_id"` CategoryID *int32 `reform:"category_id" json:"category_id"` Title *string `reform:"title" json:"title"` ISBN *string `reform:"isbn" json:"isbn"` Authors *string `reform:"authors" json:"authors"` URL string `reform:"url" json:"url"` CreatedAt time.Time `reform:"created_at" json:"created_at"` UpdatedAt time.Time `reform:"updated_at" json:"updated_at"` IsVisible bool `reform:"is_visible" json:"-"` Volumes []string `json:"volumes,omitempty"` }
Book describes book entity.
func (*Book) BeforeInsert ¶
BeforeInsert set CreatedAt and UpdatedAt.
func (*Book) PKPointer ¶
func (s *Book) PKPointer() interface{}
PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.
func (*Book) PKValue ¶
func (s *Book) PKValue() interface{}
PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.
func (*Book) Pointers ¶
func (s *Book) Pointers() []interface{}
Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.
func (*Book) Table ¶
func (s *Book) Table() reform.Table
Table returns Table object for that record.
type BookBroken ¶
type BookBroken struct { ID int32 `reform:"id,pk" json:"id"` URL string `reform:"url" json:"url"` CreatedAt time.Time `reform:"created_at" json:"created_at"` UpdatedAt time.Time `reform:"updated_at" json:"updated_at"` }
Book describes a broken (not recognizable) book.
func (*BookBroken) BeforeInsert ¶
func (b *BookBroken) BeforeInsert() error
BeforeInsert set CreatedAt and UpdatedAt.
func (*BookBroken) BeforeUpdate ¶
func (b *BookBroken) BeforeUpdate() error
BeforeUpdate set UpdatedAt.
func (*BookBroken) HasPK ¶
func (s *BookBroken) HasPK() bool
HasPK returns true if record has non-zero primary key set, false otherwise.
func (*BookBroken) PKPointer ¶
func (s *BookBroken) PKPointer() interface{}
PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.
func (*BookBroken) PKValue ¶
func (s *BookBroken) PKValue() interface{}
PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.
func (*BookBroken) Pointers ¶
func (s *BookBroken) Pointers() []interface{}
Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.
func (*BookBroken) SetPK ¶
func (s *BookBroken) SetPK(pk interface{})
SetPK sets record primary key.
func (BookBroken) String ¶
func (s BookBroken) String() string
String returns a string representation of this struct or record.
func (*BookBroken) Table ¶
func (s *BookBroken) Table() reform.Table
Table returns Table object for that record.
func (*BookBroken) Values ¶
func (s *BookBroken) Values() []interface{}
Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.
func (*BookBroken) View ¶
func (s *BookBroken) View() reform.View
View returns View object for that struct.
type Category ¶
type Category struct { ID int32 `reform:"id,pk"` Title string `reform:"title"` CreatedAt time.Time `reform:"created_at"` UpdatedAt time.Time `reform:"updated_at"` }
Category describes book category.
func (*Category) BeforeInsert ¶
BeforeInsert set CreatedAt and UpdatedAt.
func (*Category) HasPK ¶
HasPK returns true if record has non-zero primary key set, false otherwise.
func (*Category) PKPointer ¶
func (s *Category) PKPointer() interface{}
PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.
func (*Category) PKValue ¶
func (s *Category) PKValue() interface{}
PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.
func (*Category) Pointers ¶
func (s *Category) Pointers() []interface{}
Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.
func (*Category) Table ¶
func (s *Category) Table() reform.Table
Table returns Table object for that record.
type Library ¶
type Library struct { ID int32 `reform:"id,pk" json:"id"` UserID int32 `reform:"user_id" json:"-"` VolumeID int32 `reform:"volume_id" json:"volume_id"` CreatedAt time.Time `reform:"created_at" json:"created_at"` UpdatedAt time.Time `reform:"updated_at" json:"updated_at"` }
Library describes library of the user.
func (*Library) BeforeInsert ¶
BeforeInsert set CreatedAt and UpdatedAt.
func (*Library) PKPointer ¶
func (s *Library) PKPointer() interface{}
PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.
func (*Library) PKValue ¶
func (s *Library) PKValue() interface{}
PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.
func (*Library) Pointers ¶
func (s *Library) Pointers() []interface{}
Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.
func (*Library) Table ¶
func (s *Library) Table() reform.Table
Table returns Table object for that record.
type User ¶
type User struct { ID int32 `reform:"id,pk"` Email string `reform:"email"` Token string `reform:"token"` CreatedAt time.Time `reform:"created_at"` UpdatedAt time.Time `reform:"updated_at"` }
User describes some user entity.
func (*User) BeforeInsert ¶
BeforeInsert set CreatedAt and UpdatedAt.
func (*User) PKPointer ¶
func (s *User) PKPointer() interface{}
PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.
func (*User) PKValue ¶
func (s *User) PKValue() interface{}
PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.
func (*User) Pointers ¶
func (s *User) Pointers() []interface{}
Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.
func (*User) Table ¶
func (s *User) Table() reform.Table
Table returns Table object for that record.
type Volume ¶
type Volume struct { ID int32 `reform:"id,pk"` BookID int32 `reform:"book_id"` Type string `reform:"type"` CreatedAt time.Time `reform:"created_at"` UpdatedAt time.Time `reform:"updated_at"` }
Volume describes "type" of book - paperbook, ebook or audiobook.
func (*Volume) BeforeInsert ¶
BeforeInsert set CreatedAt and UpdatedAt.
func (*Volume) PKPointer ¶
func (s *Volume) PKPointer() interface{}
PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.
func (*Volume) PKValue ¶
func (s *Volume) PKValue() interface{}
PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.
func (*Volume) Pointers ¶
func (s *Volume) Pointers() []interface{}
Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.
func (*Volume) Table ¶
func (s *Volume) Table() reform.Table
Table returns Table object for that record.