Documentation ¶
Overview ¶
Example model and data manager
It contains initialized Manager (`Man`) to get|set data:
`example.Man.Get(123)`
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExampleModel ¶
type ExampleModel struct { ID int `db:"id"` Title string `db:"title" valid:"required"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
func (*ExampleModel) Validate ¶
func (t *ExampleModel) Validate() error
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Use manager to get|set data
var Man Manager = NewExampleMan(NewPostgresStorage())
Instance of Manager
func NewExampleMan ¶
func (Manager) Update ¶
func (m Manager) Update(item ExampleModel) error
type Storage ¶
type Storage interface { DBInit() error Create(item ExampleModel) (int, error) Get(id int) (ExampleModel, error) Update(item ExampleModel) error Delete(id int) error }
Interface to store data in DB
Source Files ¶
Click to show internal directories.
Click to hide internal directories.