Documentation ¶
Index ¶
- Constants
- func GetInterfacePointer(obj interface{}) interface{}
- type Record
- func (r *Record) Delete() bool
- func (r *Record) Exists() (bool, error)
- func (r *Record) ForceDelete() bool
- func (r *Record) GetDBFieldName(fieldName string) string
- func (r *Record) GetDeviceID() interface{}
- func (r *Record) GetInputFieldValue(fieldName string) (interface{}, error)
- func (r *Record) GetLastDBError() error
- func (r *Record) GetLastError() error
- func (r *Record) GetLoadedData() interface{}
- func (r *Record) GetOmitFields() []string
- func (r *Record) GetSaveData() interface{}
- func (r *Record) GetSavedData() interface{}
- func (r *Record) GetUserID() interface{}
- func (r *Record) IsCreateMode() bool
- func (r *Record) IsDBError() bool
- func (r *Record) IsLoadDataOk() bool
- func (r *Record) IsRecordFound() bool
- func (r *Record) IsRecordNotFound() bool
- func (r *Record) IsSaveMode() bool
- func (r *Record) IsStructFieldExists(fieldName string) bool
- func (r *Record) LoadData() (status bool)
- func (r *Record) PreparePrimaryKeys()
- func (r *Record) ReloadData() bool
- func (r *Record) RemoveOmitField(fieldName string)
- func (r *Record) Save() bool
- func (r *Record) SetDeviceID(deviceID interface{}) *Record
- func (r *Record) SetOmitField(fieldName string)
- func (r *Record) SetSaveData(saveData interface{}) *Record
- func (r *Record) SetSaveFieldValue(fieldName string, value interface{})
- func (r *Record) SetUserID(userID interface{}) *Record
Constants ¶
View Source
const ( ModeSave = "save" ModeCreate = "create" )
Variables ¶
This section is empty.
Functions ¶
func GetInterfacePointer ¶
func GetInterfacePointer(obj interface{}) interface{}
Types ¶
type Record ¶
type Record struct { // This is the model which the user has set, after that is the model from which we read back the data! // it should be with pointer address //NonPtrObj interface{} // ================== INPUT DATA ===================\\ // Data -> can be a map[string]interface{} or a real any Struct from where we will copy the data! Data interface{} // ================== MODEL STRUCTURE ===================\\ // this is the structure of the set NonPtrObj, it's a pointer! ModelStruct interface{} // AutoLoad -> should auto load the data if it's an existing record // TODO: posibil ca acesta nu trebuie sa lucreze in module in care noi cerem datele de la DB apoi facem merge, si apoi // actualizam..., ar trebui invers sa facem... sa actualizam doar diferenta in DB, apoi sa cerem record-ul, si apoi // sa vedem ce schimbari au fost facute... insa intrebarea consta in aceea -> DAR CARE A FOST OLD RECORD?! // Db-ul nu ne raspunde cu astfel de informatie..., de aceea totusi este necesar sa incarcam mai intii informatia // aici in memorie si apoi sa actualizam DB doar cu diferenta! diferenta e Input Data! // noi am putea sa folosim acelasi input data ca saveData si sa indicam denumirea tabelului manual.... // sau GORM automat face diferenta?!! AutoLoad bool Ctx context.Context DB *gorm.DB // You can specify: save,create,insert,update SaveMode string // contains filtered or unexported fields }
func (*Record) ForceDelete ¶
ForceDelete -> it will completely delete the record from the DB
func (*Record) GetDBFieldName ¶
func (*Record) GetDeviceID ¶
func (r *Record) GetDeviceID() interface{}
func (*Record) GetInputFieldValue ¶
GetInputFieldValue -> will return the value that has been set!
func (*Record) GetLastDBError ¶
func (*Record) GetLastError ¶
func (*Record) GetLoadedData ¶
func (r *Record) GetLoadedData() interface{}
func (*Record) GetOmitFields ¶
func (*Record) GetSaveData ¶
func (r *Record) GetSaveData() interface{}
func (r *Record) GetSaveData() map[string]interface{} {
func (*Record) GetSavedData ¶
func (r *Record) GetSavedData() interface{}
func (*Record) IsCreateMode ¶
func (*Record) IsLoadDataOk ¶
func (*Record) IsRecordFound ¶
func (*Record) IsRecordNotFound ¶
func (*Record) IsSaveMode ¶
func (*Record) IsStructFieldExists ¶
func (*Record) LoadData ¶
LoadData -> from the db, it loads the data if exists, if it doesn't exist then it return true!
func (*Record) PreparePrimaryKeys ¶
func (r *Record) PreparePrimaryKeys()
func (*Record) ReloadData ¶
ReloadData -> it will forcefully reload the data
func (*Record) RemoveOmitField ¶
func (*Record) SetDeviceID ¶
func (*Record) SetOmitField ¶
func (*Record) SetSaveData ¶
func (r *Record) SetSaveData(saveData map[string]interface{}) *Record {
func (*Record) SetSaveFieldValue ¶
Click to show internal directories.
Click to hide internal directories.