Documentation ¶
Index ¶
- func Configure(c *Config) bool
- func Count(t string, c *Criteria) int
- func Fetch[T Modeller](m T, c *Criteria) ([]T, bool)
- func First[T Modeller](m T, c *Criteria) (T, bool)
- func RawExecute(sql string) bool
- func RawScalar(sql string) (interface{}, bool)
- func RawSelect(sql string) []map[string]interface{}
- func Remove(m Modeller) bool
- func RemoveMany(t string, c *Criteria) (int, bool)
- func Save(m Modeller) bool
- type Config
- type Criteria
- type Model
- type ModelState
- type Modeller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Configure ¶
Configure loads the configraution for connection to the database. This must be done before all other database operations
func Fetch ¶
Fetch populates the slice with models from the database that match the criteria. Returns false if this fails
func First ¶
First populates the model with the first record from the database that match the criteria. Returns false if this fails or there is no record to return
func RawExecute ¶
RawExecute executes a sql statement on the database, without returning a value Not recommended for general use - can break shadowing
func RawScalar ¶
RawScalar exeutes a raw sql statement that returns a single value Not recommended for general use
func RawSelect ¶
RawSelect executes a raw sql statement on the database Not recommended for general use
func RemoveMany ¶
RemoveMany removes all records from the named table that match the criteria
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is the database configuration
type Model ¶
type Model struct { ID *string CreateDate time.Time LastUpdate time.Time DeleteDate *time.Time // contains filtered or unexported fields }
Model is the base for all database models
func (Model) StandingData ¶
StandingData returns the standing data for when the table is created
type Modeller ¶
type Modeller interface { // StandingData returns the standing data for the model StandingData() []Modeller // GetID returns the ID of the model GetID() *string // IsNew returns true if the model has yet to be saved IsNew() bool // IsDeleted returns true if the model has been marked as deleted IsDeleted() bool }
Modeller defines the common functionality of a Model
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package clause This is a very basic, and yet versatile ORM package.
|
Package clause This is a very basic, and yet versatile ORM package. |
Package order This is a very basic, and yet versatile ORM package.
|
Package order This is a very basic, and yet versatile ORM package. |