Documentation ¶
Index ¶
- Constants
- Variables
- func ArrayIntContains(arr []int, val int) bool
- func ArrayMapToMapUnderscore(rec interface{}) ([]map[string]interface{}, error)
- func ArrayMapToStruct(actParams ActionParamsType, recs interface{}) (interface{}, error)
- func ArrayStringContains(arr []string, val string) bool
- func ArrayToSQLStringValues(arr []string) string
- func CheckTaskType(params CrudParamsType) string
- func CheckTaskTypeV1(params CrudParamsType) string
- func ComputeTaskDuration(start time.Time, end time.Time) int64
- func ConvertByteSliceToBase64Str(fileContent []byte) string
- func ConvertJsonBase64StringToMap(base64Str interface{}) (map[string]interface{}, error)
- func ConvertJsonBase64StringToTypeValue(base64Str interface{}, typePointer interface{}) (interface{}, error)
- func ConvertJsonStringToMapValue(jsonStr string) (map[string]interface{}, error)
- func ConvertJsonStringToTypeValue(jsonStr string, typePointer interface{}) (interface{}, error)
- func ConvertStringToBase64Str(fileContent string) string
- func GetParamsMessage(msgObject MessageObject) mcresponse.ResponseMessage
- func JsonToStruct(jsonRec []byte, rec interface{}) error
- func MapToMapCamelCase(rec interface{}, sep string) (map[string]interface{}, error)
- func MapToMapUnderscore(rec interface{}) (map[string]interface{}, error)
- func MapToStruct(mapRecord map[string]interface{}, rec interface{}) (interface{}, error)
- func ParseRawValues(rawValues [][]byte) ([]interface{}, error)
- func QueryFields(modelRef interface{}) (string, error)
- func RandomNumbers(n int) string
- func RandomString(n int) string
- func StructToFieldValues(rec interface{}) ([]string, []interface{}, error)
- func StructToMap(rec interface{}) (map[string]interface{}, error)
- func StructToMapToCamelCase(rec interface{}, sep string) (map[string]interface{}, error)
- func StructToMapUnderscore(rec interface{}) (map[string]interface{}, error)
- func StructToTagMap(rec interface{}, tag string) (map[string]interface{}, error)
- func TagField(rec interface{}, fieldName string, tag string) (string, error)
- func ToCamelCase(text string, sep string) string
- func TypeOf(rec interface{}) reflect.Type
- func ValidateSubActionParams(actParams ActionParamsType, subAppIds []string) bool
- type AccessInfoType
- type AccessLogger
- type AccessLoggerx
- type AccessResValueType
- type ActionParamType
- type ActionParamsType
- type AppBaseModelPtrType
- type AppBaseModelType
- type AppParamsType
- type Application
- type ApplicationPtr
- type Audit
- type AuditLogOptionsType
- type AuditLogOptionsXType
- type AuditLogger
- type AuditLoggerx
- type AuditParamsType
- type AuditPtr
- type AuditStampType
- type AuthError
- type BaseModelPtrType
- type BaseModelType
- type CheckAccessParamsType
- type CheckAccessType
- type ConnectError
- type CreateError
- type CreateLogger
- type CreateLoggerx
- type CreateQueryError
- type CreateQueryObject
- type CreateQueryResult
- type Crud
- func (crud *Crud) CheckLoginStatus() mcresponse.ResponseMessage
- func (crud *Crud) CheckSaveTaskType() string
- func (crud *Crud) CheckTaskAccess() mcresponse.ResponseMessage
- func (crud *Crud) CheckUserAccess() mcresponse.ResponseMessage
- func (crud *Crud) Create(recs ActionParamsType) mcresponse.ResponseMessage
- func (crud *Crud) CustomSelectQuery(params CustomSelectQueryParamsType) mcresponse.ResponseMessage
- func (crud *Crud) DeleteAll() mcresponse.ResponseMessage
- func (crud *Crud) DeleteById(id string) mcresponse.ResponseMessage
- func (crud *Crud) DeleteByIds() mcresponse.ResponseMessage
- func (crud *Crud) DeleteByParam() mcresponse.ResponseMessage
- func (crud *Crud) DeleteRecord() mcresponse.ResponseMessage
- func (crud *Crud) GetAll() mcresponse.ResponseMessage
- func (crud *Crud) GetAll1() mcresponse.ResponseMessage
- func (crud *Crud) GetById(id string) mcresponse.ResponseMessage
- func (crud *Crud) GetById1(id string) mcresponse.ResponseMessage
- func (crud *Crud) GetByIds() mcresponse.ResponseMessage
- func (crud *Crud) GetByIds1() mcresponse.ResponseMessage
- func (crud *Crud) GetByParam() mcresponse.ResponseMessage
- func (crud *Crud) GetByParam1() mcresponse.ResponseMessage
- func (crud *Crud) GetRecord() mcresponse.ResponseMessage
- func (crud *Crud) GetRecords() mcresponse.ResponseMessage
- func (crud *Crud) GetRoleServices(accessDb *sqlx.DB, roleTable string, userRoleId string, serviceIds []string) ([]RoleServiceType, error)
- func (crud *Crud) GetStream() mcresponse.ResponseMessage
- func (crud *Crud) RecordsCount() (totalRecords int, ownerRecords int, err error)
- func (crud *Crud) SaveRecord() mcresponse.ResponseMessage
- func (crud *Crud) String() string
- func (crud *Crud) TaskPermissionById(taskType string) mcresponse.ResponseMessage
- func (crud *Crud) TaskPermissionByParam(taskType string) mcresponse.ResponseMessage
- func (crud *Crud) Update(recs ActionParamsType) mcresponse.ResponseMessage
- func (crud *Crud) UpdateById(rec ActionParamType, id string) mcresponse.ResponseMessage
- func (crud *Crud) UpdateByIds(rec ActionParamType) mcresponse.ResponseMessage
- func (crud *Crud) UpdateByParam(rec ActionParamType) mcresponse.ResponseMessage
- type CrudOptionsType
- type CrudParamsType
- type CrudResultType
- type CrudTasksType
- type CustomSelectQueryParamsType
- type DbConfig
- type DbConfigType
- type DbConnectOptions
- type DbConnectionType
- type DbSecureType
- type DeleteCrudParamsType
- type DeleteError
- type DeleteLogger
- type DeleteLoggerx
- type DeleteParamsType
- type DeleteQueryError
- type DeleteQueryObject
- type DeleteQueryResult
- type EmailAddressType
- type EmailUserNameType
- type ErrorType
- type FieldValueType
- type GetCrudParamsType
- type GetParamsType
- type GetResultType
- type GetStatType
- type IDs
- type LogParam
- func (log LogParam) AuditLog(logType, userId string, options AuditLogOptionsType) (mcresponse.ResponseMessage, error)
- func (log LogParam) CreateLog(table string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
- func (log LogParam) CustomLog(params AuditParamsType) (mcresponse.ResponseMessage, error)
- func (log LogParam) DeleteLog(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
- func (log LogParam) LoginLog(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error)
- func (log LogParam) LogoutLog(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error)
- func (log LogParam) ReadLog(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
- func (log LogParam) String() string
- func (log LogParam) UpdateLog(tableName string, logRecords interface{}, newLogRecords interface{}, ...) (mcresponse.ResponseMessage, error)
- type LogParamX
- func (log LogParamX) AuditLog(logType, userId string, options AuditLogOptionsType) (mcresponse.ResponseMessage, error)
- func (log LogParamX) CreateLogx(table string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
- func (log LogParamX) CustomLog(params AuditParamsType) (mcresponse.ResponseMessage, error)
- func (log LogParamX) DeleteLogx(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
- func (log LogParamX) LoginLogx(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error)
- func (log LogParamX) LogoutLogx(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error)
- func (log LogParamX) ReadLogx(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
- func (log LogParamX) String() string
- func (log LogParamX) UpdateLogx(tableName string, logRecords interface{}, newLogRecords interface{}, ...) (mcresponse.ResponseMessage, error)
- type LogRecordsType
- type MessageObject
- type ModelOptionsType
- type MultiUpdateQueryResult
- type OkResponse
- type Profile
- type ProjectParamType
- type QueryParamType
- type ReadError
- type ReadLogger
- type ReadLoggerx
- type RelationBaseModelPtrType
- type RelationBaseModelType
- type RoleFuncType
- type RoleServiceType
- type SaveCrudParamsType
- type SaveError
- type SaveParamsType
- type SaveResultType
- type SelectQueryError
- type SelectQueryObject
- type SelectQueryOptions
- type SelectQueryResult
- func ComputeSelectQueryAll(modelRef interface{}, tableName string, options SelectQueryOptions) SelectQueryResult
- func ComputeSelectQueryById(modelRef interface{}, tableName string, recordId string, ...) SelectQueryResult
- func ComputeSelectQueryByIds(modelRef interface{}, tableName string, recordIds []string, ...) SelectQueryResult
- func ComputeSelectQueryByParam(modelRef interface{}, tableName string, queryParam QueryParamType, ...) SelectQueryResult
- type SortParamType
- type TaskPermissionType
- type UpdateError
- type UpdateLogger
- type UpdateLoggerx
- type UpdateQueryError
- type UpdateQueryObject
- type UpdateQueryResult
- func ComputeUpdateQueryById(tableName string, actionParam ActionParamType, recordId string) UpdateQueryResult
- func ComputeUpdateQueryByIds(tableName string, actionParam ActionParamType, recordIds []string) UpdateQueryResult
- func ComputeUpdateQueryByParam(tableName string, actionParam ActionParamType, queryParam QueryParamType) UpdateQueryResult
- type UserInfoType
- type ValidateResponseType
- type ValueToDataType
- type WhereQueryError
- type WhereQueryObject
- type WhereQueryResult
Constants ¶
const ( CreateLog = "create" UpdateLog = "update" ReadLog = "read" GetLog = "get" DeleteLog = "delete" RemoveLog = "remove" LoginLog = "login" LogoutLog = "logout" )
constants LogTypes
const ( CreateTask = "create" InsertTask = "insert" UpdateTask = "update" ReadTask = "read" DeleteTask = "delete" RemoveTask = "remove" LoginTask = "login" LogoutTask = "logout" SystemTask = "system" AppTask = "app" UnknownTask = "unknown" )
const ( CrudQueryFieldCustom = "custom" CrudQueryFieldDefault = "underscore" )
const AuditTable = "audits"
const DeleteAllTable = "audits_delete_all"
const DeleteTable = "audits_delete"
const GetTable = "audits_get"
const UpdateTable = "audits_update"
const UserId = "c85509ac-7373-464d-b667-425bb59b5738" // TODO: review/update
Variables ¶
var AuditCreateActionParams = ActionParamsType{ AuditCreateRec1, AuditCreateRec2, }
var AuditCreateRec1 = ActionParamType{ "tableName": "audits", "logAt": time.Now(), "logBy": UserId, "logRecords": string(LogRecs), "logType": CreateTask, }
var AuditCreateRec2 = ActionParamType{ "tableName": "audits", "logAt": time.Now(), "logBy": UserId, "logRecords": string(LogRecs2), "logType": CreateTask, }
var AuditUpdateActionParams = ActionParamsType{ AuditUpdateRec1, AuditUpdateRec2, }
var AuditUpdateRec1 = ActionParamType{ "id": "c1c3f614-b10d-40a4-9269-4e03f5fcf55e", "tableName": "todos", "logAt": time.Now(), "logBy": UserId, "logRecords": string(LogRecs), "newLogRecords": string(NewLogRecs), "logType": UpdateTask, }
var AuditUpdateRec2 = ActionParamType{ "id": "003c1422-c7cb-476f-b96f-9c8028e04a14", "tableName": "todos", "logAt": time.Now(), "logBy": UserId, "logRecords": string(LogRecs2), "newLogRecords": string(NewLogRecs2), "logType": UpdateTask, }
var AuditUpdateRecordById = ActionParamType{ "id": "b126f4c0-9bad-4242-bec1-4c4ab74ae481", "tableName": "groups", "logAt": time.Now(), "logBy": UserId, "logRecords": string(LogRecs), "newLogRecords": string(NewLogRecs), "logType": DeleteTask, }
var AuditUpdateRecordByParam = ActionParamType{ "id": "f380f132-422f-4cd4-82c1-07b4caf35da0", "tableName": "contacts", "logAt": time.Now(), "logBy": UserId, "logRecords": string(LogRecs), "newLogRecords": string(NewLogRecs), "logType": UpdateTask, }
var CrudParamOptions = CrudOptionsType{ CheckAccess: false, AuditTable: "audits", UserTable: "users", ProfileTable: "profiles", ServiceTable: "services", AccessTable: "accesses", VerifyTable: "verify_users", RoleTable: "roles", LogCrud: false, LogCreate: false, LogUpdate: false, LogDelete: false, LogRead: false, LogLogin: false, LogLogout: false, MaxQueryLimit: 100000, MsgFrom: "support@mconnect.biz", }
var DeleteAuditById = "99f0f869-3c84-4a5e-83ac-3b9f893dcd60"
var DeleteAuditByIds = []string{
"9e9f7733-7653-4069-9f42-dc157768a960",
"35304003-567f-4e25-9f1d-6483760db621",
"d0a1445e-f12f-4d45-98e5-22689dec48e5",
"39774322-9be5-4b43-9d6e-e2ba514e0f43",
}
var DeleteAuditByParams = QueryParamType{
"logType": "read",
}
var GetAuditById = "7461ae6c-96e0-4b4f-974b-9a0a7f91e016"
var GetAuditByIds = []string{"7461ae6c-96e0-4b4f-974b-9a0a7f91e016", "aa9ba999-b138-414b-be66-9f0264e50f4a"}
var GetAuditByParams = QueryParamType{
"logType": "create",
}
var LogRecords = ActionParamType{
"name": "Abi",
"desc": "Testing only",
"url": "localhost:9000",
"priority": 100,
"cost": 1000.00,
}
var LogRecords2 = ActionParamType{
"name": "Ola",
"desc": "Testing only - 2",
"url": "localhost:9000",
"priority": 1,
"cost": 10000.00,
}
var LogRecs, _ = json.Marshal(LogRecords)
var LogRecs2, _ = json.Marshal(LogRecords2)
var NewLogRecords = ActionParamType{
"name": "Abi Akindele",
"desc": "Testing only - updated",
"url": "localhost:9900",
"priority": 1,
"cost": 2000.00,
}
var NewLogRecords2 = ActionParamType{
"name": "Ola",
"desc": "Testing only - 2 - updated",
"url": "localhost:9000",
"priority": 1,
"cost": 20000.00,
}
var NewLogRecs, _ = json.Marshal(NewLogRecords)
var NewLogRecs2, _ = json.Marshal(NewLogRecords2)
var TestUserInfo = UserInfoType{ UserId: "c85509ac-7373-464d-b667-425bb59b5738", LoginName: "abbeymart", Email: "abbeya1@yahoo.com", Language: "en-US", Firstname: "Abi", Lastname: "Akindele", Token: "", Expire: 0, RoleId: "", }
var UpdateAuditById = "98bb024e-2b22-42b4-b379-7099166ad1c9"
var UpdateAuditByIds = []string{
"c158c19f-e396-4625-96ee-d054ef4f40a1",
"e34b10f9-6320-4573-96cc-2cd8c69c9a89",
"9b9acf43-9008-4261-9528-39f47f261adf",
}
var UpdateAuditByParams = QueryParamType{
"logType": "read",
}
Functions ¶
func ArrayIntContains ¶
ArrayIntContains check if a slice of int contains/includes an int value
func ArrayMapToMapUnderscore ¶
ArrayMapToMapUnderscore converts []map-fields to underscore
func ArrayMapToStruct ¶
func ArrayMapToStruct(actParams ActionParamsType, recs interface{}) (interface{}, error)
ArrayMapToStruct converts []map/actParams to []struct/model-type
func ArrayStringContains ¶
ArrayStringContains check if a slice of string contains/includes a string value
func ArrayToSQLStringValues ¶
ArrayToSQLStringValues transforms a slice of string to SQL-string-formatted-values
func CheckTaskType ¶
func CheckTaskType(params CrudParamsType) string
CheckTaskType function determines and returns the taskType, based on the actionParams from the CrudParamsType
func CheckTaskTypeV1 ¶ added in v0.6.3
func CheckTaskTypeV1(params CrudParamsType) string
CheckTaskTypeV1 determine/set task type based on the actionParams - update tag-v0.6.2 to v0.6.3
func ComputeTaskDuration ¶
ComputeTaskDuration computes the task interval in microseconds
func ConvertJsonBase64StringToMap ¶
ConvertJsonBase64StringToMap converts the db-json-string-value to the map-type
func ConvertJsonBase64StringToTypeValue ¶
func ConvertJsonBase64StringToTypeValue(base64Str interface{}, typePointer interface{}) (interface{}, error)
ConvertJsonBase64StringToTypeValue converts the db-json-string-value to the base-type
func ConvertJsonStringToMapValue ¶
ConvertJsonStringToMapValue converts the db-json-string-value to the map-type
func ConvertJsonStringToTypeValue ¶
ConvertJsonStringToTypeValue converts the db-json-string-value to the base-type
func GetParamsMessage ¶
func GetParamsMessage(msgObject MessageObject) mcresponse.ResponseMessage
GetParamsMessage compose the message-object into mcresponse.ResponseMessage
func JsonToStruct ¶
JsonToStruct converts json inputs to equivalent struct data type specification rec must be a pointer to a type matching the jsonRec
func MapToMapCamelCase ¶
MapToMapCamelCase converts map underscore-fields to camelCase-fields
func MapToMapUnderscore ¶
MapToMapUnderscore converts map camelCase-fields to underscore-fields
func MapToStruct ¶
MapToStruct converts map to struct
func ParseRawValues ¶
ParseRawValues process the raw rows/records from SQL-query
func QueryFields ¶ added in v0.5.0
QueryFields function computes the underscore field-names from the specified model
func RandomNumbers ¶
RandomNumbers generates random numbers using rand.Perm and returns []int as string
func RandomString ¶
RandomString generates random string of characters and numbers
func StructToFieldValues ¶
StructToFieldValues converts struct to record fields(underscore) and associated values (columns and values)
func StructToMap ¶
StructToMap function converts struct to map
func StructToMapToCamelCase ¶
func StructToMapUnderscore ¶
StructToMapUnderscore converts struct to map (underscore_fields), for crud-db-table-record
func StructToTagMap ¶
StructToTagMap function converts struct to map (tag/underscore_field), for crud-db-table-record
func ToCamelCase ¶
func ValidateSubActionParams ¶
func ValidateSubActionParams(actParams ActionParamsType, subAppIds []string) bool
ValidateSubActionParams validates that subscriber-appIds includes actionParam-appId, for save - create/update tasks
Types ¶
type AccessInfoType ¶
type AccessInfoType struct { UserId string `json:"userId"` Username string `json:"username"` Email string `json:"email"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` RoleId string `json:"roleId"` RoleIds []string `json:"roleIds"` RoleName string `json:"roleName"` RoleNames []string `json:"roleNames"` IsAdmin bool `json:"isAdmin"` IsActive bool `json:"isActive"` }
AccessInfoType for CheckUserAccess method value (interface{}) response, and to assert returned value
type AccessLogger ¶
type AccessLogger interface { LoginLog(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error) LogoutLog(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error) }
type AccessLoggerx ¶
type AccessLoggerx interface { LoginLog(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error) LogoutLog(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error) }
type AccessResValueType ¶
type AccessResValueType struct { AccessInfo AccessInfoType `json:"accessInfo"` IsAdmin bool `json:"isAdmin"` SystemAdmin bool `json:"systemAdmin"` UserAdmin bool `json:"userAdmin"` AppIds []string `json:"appIds"` }
func ComputeAccessResValue ¶
func ComputeAccessResValue(params mcresponse.ResponseMessage) AccessResValueType
ComputeAccessResValue returns the transform access-response-value of AccessResValueType
type ActionParamType ¶
type ActionParamType map[string]interface{}
func DataToValueParam ¶
func DataToValueParam(rec interface{}) (ActionParamType, error)
DataToValueParam accepts only a struct type/model and returns the ActionParamType data camel/Pascal-case keys are converted to underscore-keys to match table-field/columns specs
func ExcludeEmptyIdFields ¶
func ExcludeEmptyIdFields(recs []ActionParamType) []ActionParamType
func ExcludeEmptyIdFromMapRecord ¶
func ExcludeEmptyIdFromMapRecord(rec ActionParamType) ActionParamType
func ExcludeFieldFromMapRecord ¶
func ExcludeFieldFromMapRecord(rec ActionParamType, field string) ActionParamType
ExcludeFieldFromMapRecord exclude id and accessKey fields
type ActionParamsType ¶
type ActionParamsType []ActionParamType
type AppBaseModelPtrType ¶
type AppBaseModelPtrType struct { Id string `json:"id" db:"id"` Language *string `json:"language" db:"language"` Description *string `json:"description" db:"description"` AppId *string `json:"appId" db:"app_id"` // application-id in a multi-hosted apps environment (e.g. cloud-env) IsActive bool `json:"isActive" db:"is_active"` // => activate by modelOptionsType settings... CreatedBy *string `json:"createdBy" db:"created_by"` CreatedAt *time.Time `json:"createdAt" db:"created_at"` UpdatedBy *string `json:"updatedBy" db:"updated_by"` UpdatedAt *time.Time `json:"updatedAt" db:"updated_at"` }
type AppBaseModelType ¶
type AppBaseModelType struct { Id string `json:"id" db:"id"` Language string `json:"language" db:"language"` Description string `json:"description" db:"description"` AppId string `json:"appId" db:"app_id"` // application-id in a multi-hosted apps environment (e.g. cloud-env) IsActive bool `json:"isActive" db:"is_active"` // => activate by modelOptionsType settings... CreatedBy string `json:"createdBy" db:"created_by"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedBy string `json:"updatedBy" db:"updated_by"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
type AppParamsType ¶
type AppParamsType struct { AppId string `json:"appId"` AccessKey string `json:"accessKey"` AppName string `json:"appName"` // optional app-name Category string `json:"category"` ServiceId string `json:"serviceId"` ServiceTag string `json:"serviceTag"` }
AppParamsType is the type for validating app-access
type Application ¶
type Application struct { Id string `json:"id" db:"id"` AppName string `json:"appName" db:"app_name"` AccessKey string `json:"accessKey" db:"access_key"` Language string `json:"language" db:"language"` Description string `json:"description" db:"description"` IsActive bool `json:"isActive" db:"is_active"` CreatedBy string `json:"createdBy" db:"created_by"` UpdatedBy string `json:"updatedBy" db:"updated_by"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` AppCategory *string `json:"appCategory" db:"app_category"` }
type ApplicationPtr ¶
type ApplicationPtr struct { Id string `json:"id" db:"id"` AppName string `json:"appName" db:"app_name"` AccessKey string `json:"accessKey" db:"access_key"` Language string `json:"language" db:"language"` Description string `json:"description" db:"description"` IsActive bool `json:"isActive" db:"is_active"` CreatedBy *string `json:"createdBy" db:"created_by"` UpdatedBy *string `json:"updatedBy" db:"updated_by"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` AppCategory *string `json:"appCategory" db:"app_category"` }
type Audit ¶
type Audit struct { Id string `json:"id" db:"id"` TableName string `json:"tableName" db:"table_name"` LogRecords interface{} `json:"logRecords" db:"log_records"` NewLogRecords interface{} `json:"newLogRecords" db:"new_log_records"` LogType string `json:"logType" db:"log_type"` LogBy string `json:"logBy" db:"log_by"` LogAt time.Time `json:"logAt" db:"log_at"` }
type AuditLogOptionsType ¶
type AuditLogOptionsType struct { AuditTable string TableName string LogRecords interface{} NewLogRecords interface{} QueryParams QueryParamType RecordIds []string }
type AuditLogOptionsXType ¶
type AuditLogger ¶
type AuditLogger interface {
AuditLog(logType, userId string, options AuditLogOptionsType) (mcresponse.ResponseMessage, error)
}
type AuditLoggerx ¶
type AuditLoggerx interface {
AuditLog(logType, userId string, options AuditLogOptionsType) (mcresponse.ResponseMessage, error)
}
type AuditParamsType ¶ added in v0.6.0
type AuditPtr ¶
type AuditPtr struct { Id string `json:"id" db:"id"` TableName string `json:"tableName" db:"table_name"` LogRecords interface{} `json:"logRecords" db:"log_records"` NewLogRecords interface{} `json:"newLogRecords" db:"new_log_records"` LogType string `json:"logType" db:"log_type"` LogBy *string `json:"logBy" db:"log_by"` LogAt time.Time `json:"logAt" db:"log_at"` }
type AuditStampType ¶
type BaseModelPtrType ¶
type BaseModelPtrType struct { Id string `json:"id" db:"id"` Language *string `json:"language" db:"language"` Description *string `json:"description" db:"description"` IsActive bool `json:"isActive" db:"is_active"` // => activate by modelOptionsType settings... CreatedBy *string `json:"createdBy" db:"created_by"` CreatedAt *time.Time `json:"createdAt" db:"created_at"` UpdatedBy *string `json:"updatedBy" db:"updated_by"` UpdatedAt *time.Time `json:"updatedAt" db:"updated_at"` }
type BaseModelType ¶
type BaseModelType struct { Id string `json:"id" db:"id"` Language string `json:"language" db:"language"` Description string `json:"description" db:"description"` IsActive bool `json:"isActive" db:"is_active"` // => activate by modelOptionsType settings... CreatedBy string `json:"createdBy" db:"created_by"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedBy string `json:"updatedBy" db:"updated_by"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
type CheckAccessParamsType ¶
type CheckAccessParamsType struct { AccessDb *sqlx.DB `json:"accessDb"` UserInfo UserInfoType `json:"userInfo"` TableName string `json:"tableName"` RecordIds []string `json:"recordIds"` // for update, delete and read tasks AccessTable string `json:"accessTable"` UserTable string `json:"userTable"` RoleTable string `json:"roleTable"` ServiceTable string `json:"serviceTable"` ProfileTable string `json:"profileTable"` }
type CheckAccessType ¶
type CheckAccessType struct { UserId string `json:"userId" mcorm:"userId"` RoleId string `json:"roleId" mcorm:"roleId"` RoleIds []string `json:"roleIds" mcorm:"roleIds"` IsActive bool `json:"isActive" mcorm:"isActive"` IsAdmin bool `json:"isAdmin" mcorm:"isAdmin"` RoleServices []RoleServiceType `json:"roleServices" mcorm:"roleServices"` TableId string `json:"tableId" mcorm:"tableId"` OwnerPermitted bool `json:"ownerPermitted"` }
type ConnectError ¶
type ConnectError ErrorType
type CreateError ¶
type CreateError ErrorType
type CreateLogger ¶
type CreateLogger interface {
CreateLog(table string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
}
type CreateLoggerx ¶
type CreateLoggerx interface {
CreateLog(table string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
}
type CreateQueryError ¶
type CreateQueryError ErrorType
type CreateQueryObject ¶
type CreateQueryResult ¶
type CreateQueryResult struct { CreateQueryObject CreateQueryObject Ok bool Message string }
func ComputeCreateQuery ¶
func ComputeCreateQuery(tableName string, actionParams ActionParamsType) CreateQueryResult
ComputeCreateQuery function computes insert SQL scripts. It returns createScripts []string and err error
type Crud ¶
type Crud struct { CrudParamsType CrudOptionsType CreateItems ActionParamsType UpdateItems ActionParamsType CurrentRecords []map[string]interface{} TransLog LogParamX CacheKey string // Unique for exactly the same query }
Crud object / struct
func NewCrud ¶
func NewCrud(params CrudParamsType, options CrudOptionsType) (crudInstance *Crud)
NewCrud constructor returns a new crud-instance
func (*Crud) CheckLoginStatus ¶
func (crud *Crud) CheckLoginStatus() mcresponse.ResponseMessage
CheckLoginStatus method checks if the user exists and has active login status/token
func (*Crud) CheckSaveTaskType ¶
CheckSaveTaskType determines the crud-task type based on actionParams[0] record (i.e. first record in the array)
func (*Crud) CheckTaskAccess ¶
func (crud *Crud) CheckTaskAccess() mcresponse.ResponseMessage
CheckTaskAccess method determines the access by role-assignment
func (*Crud) CheckUserAccess ¶
func (crud *Crud) CheckUserAccess() mcresponse.ResponseMessage
CheckUserAccess method determines the user access status: active, valid login and admin
func (*Crud) Create ¶
func (crud *Crud) Create(recs ActionParamsType) mcresponse.ResponseMessage
Create method creates new record(s)
func (*Crud) CustomSelectQuery ¶ added in v0.5.0
func (crud *Crud) CustomSelectQuery(params CustomSelectQueryParamsType) mcresponse.ResponseMessage
CustomSelectQuery method obtain the query result for the specified selectQuery, tableName and modelPointer and optional fieldPositionalValues.
func (*Crud) DeleteAll ¶
func (crud *Crud) DeleteAll() mcresponse.ResponseMessage
DeleteAll method deletes or removes all records in the tables. Recommended for admin-users only Use if and only if you know what you are doing
func (*Crud) DeleteById ¶
func (crud *Crud) DeleteById(id string) mcresponse.ResponseMessage
DeleteById method deletes or removes record(s) by record-id(s)
func (*Crud) DeleteByIds ¶
func (crud *Crud) DeleteByIds() mcresponse.ResponseMessage
DeleteByIds method deletes or removes record(s) by record-id(s)
func (*Crud) DeleteByParam ¶
func (crud *Crud) DeleteByParam() mcresponse.ResponseMessage
DeleteByParam method deletes or removes record(s) by query-parameters or where conditions
func (*Crud) DeleteRecord ¶
func (crud *Crud) DeleteRecord() mcresponse.ResponseMessage
DeleteRecord method deletes/removes record(s) by recordIds or queryParams
func (*Crud) GetAll ¶
func (crud *Crud) GetAll() mcresponse.ResponseMessage
GetAll method fetches/gets/reads all record(s), constrained by optional skip and limit parameters
func (*Crud) GetAll1 ¶
func (crud *Crud) GetAll1() mcresponse.ResponseMessage
GetAll1 method fetches/gets/reads all record(s), constrained by optional skip and limit parameters
func (*Crud) GetById ¶
func (crud *Crud) GetById(id string) mcresponse.ResponseMessage
func (*Crud) GetById1 ¶
func (crud *Crud) GetById1(id string) mcresponse.ResponseMessage
func (*Crud) GetByIds ¶
func (crud *Crud) GetByIds() mcresponse.ResponseMessage
GetByIds method fetches/gets/reads records that met the specified record-ids, constrained by optional skip and limit parameters
func (*Crud) GetByIds1 ¶
func (crud *Crud) GetByIds1() mcresponse.ResponseMessage
func (*Crud) GetByParam ¶
func (crud *Crud) GetByParam() mcresponse.ResponseMessage
GetByParam method fetches/gets/reads records that met the specified query-params or where conditions, constrained by optional skip and limit parameters
func (*Crud) GetByParam1 ¶
func (crud *Crud) GetByParam1() mcresponse.ResponseMessage
GetByParam1 method fetches/gets/reads records that met the specified query-params or where conditions, constrained by optional skip and limit parameters
func (*Crud) GetRecord ¶
func (crud *Crud) GetRecord() mcresponse.ResponseMessage
GetRecord method fetches records by recordIds, queryParams or all
func (*Crud) GetRecords ¶
func (crud *Crud) GetRecords() mcresponse.ResponseMessage
GetRecords method fetches records by recordIds, queryParams or all - lookup-items (no-access-constraint)
func (*Crud) GetRoleServices ¶
func (crud *Crud) GetRoleServices(accessDb *sqlx.DB, roleTable string, userRoleId string, serviceIds []string) ([]RoleServiceType, error)
GetRoleServices method process and returns the permission to user / user-group/roleId for the specified service items
func (*Crud) GetStream ¶
func (crud *Crud) GetStream() mcresponse.ResponseMessage
func (*Crud) RecordsCount ¶
RecordsCount returns the totalRecordsCount, ownerRecordsCount and error, if applicable
func (*Crud) SaveRecord ¶
func (crud *Crud) SaveRecord() mcresponse.ResponseMessage
SaveRecord method creates new record(s) or updates existing record(s)
func (*Crud) TaskPermissionById ¶
func (crud *Crud) TaskPermissionById(taskType string) mcresponse.ResponseMessage
TaskPermissionById method determines the access permission by owner, role/group (on coll/table or doc/record(s)) or admin for various : create/insert, update, delete/remove, read
func (*Crud) TaskPermissionByParam ¶
func (crud *Crud) TaskPermissionByParam(taskType string) mcresponse.ResponseMessage
func (*Crud) Update ¶
func (crud *Crud) Update(recs ActionParamsType) mcresponse.ResponseMessage
Update method updates existing record(s)
func (*Crud) UpdateById ¶
func (crud *Crud) UpdateById(rec ActionParamType, id string) mcresponse.ResponseMessage
UpdateById method updates existing records (in batch) that met the specified record-id(s)
func (*Crud) UpdateByIds ¶
func (crud *Crud) UpdateByIds(rec ActionParamType) mcresponse.ResponseMessage
UpdateByIds method updates existing records (in batch) that met the specified record-id(s)
func (*Crud) UpdateByParam ¶
func (crud *Crud) UpdateByParam(rec ActionParamType) mcresponse.ResponseMessage
UpdateByParam method updates existing records (in batch) that met the specified query-params or where conditions
type CrudOptionsType ¶
type CrudOptionsType struct { CheckAccess bool CacheResult bool BulkCreate bool AccessDb *sqlx.DB AuditDb *sqlx.DB ServiceDb *sqlx.DB AuditTable string ServiceTable string UserTable string RoleTable string AccessTable string VerifyTable string ProfileTable string UserRoleTable string MaxQueryLimit int LogCrud bool LogCreate bool LogUpdate bool LogRead bool LogDelete bool LogLogin bool LogLogout bool UnAuthorizedMessage string RecExistMessage string CacheExpire int LoginTimeout int UsernameExistsMessage string EmailExistsMessage string MsgFrom string ModelOptions ModelOptionsType FieldSeparator string AppDbs []string AppTables []string QueryFieldType string }
type CrudParamsType ¶
type CrudParamsType struct { ModelRef interface{} `json:"-"` ModelPointer interface{} `json:"-"` AppDb *sqlx.DB `json:"-"` TableName string `json:"-"` UserInfo UserInfoType `json:"userInfo"` ActionParams ActionParamsType `json:"actionParams"` QueryParams QueryParamType `json:"queryParams"` RecordIds []string `json:"recordIds"` ProjectParams ProjectParamType `json:"projectParams"` SortParams SortParamType `json:"sortParams"` Token string `json:"token"` Skip int `json:"skip"` Limit int `json:"limit"` TaskName string `json:"taskName"` TaskType string `json:"taskType"` AppParams AppParamsType `json:"appParams"` }
CrudParamsType is the struct type for receiving, composing and passing CRUD inputs
func TransformGetCrudParams ¶
func TransformGetCrudParams(params CrudParamsType, accessRes mcresponse.ResponseMessage) CrudParamsType
TransformGetCrudParams compose the crud-params for read-query
type CrudResultType ¶
type CrudResultType struct { QueryParam QueryParamType `json:"queryParam"` RecordIds []string `json:"recordIds"` RecordsCount int `json:"recordsCount"` Records []map[string]interface{} `json:"records"` TaskType string `json:"taskType"` LogRes mcresponse.ResponseMessage `json:"logRes"` }
type CrudTasksType ¶
type CrudTasksType struct { Create string Insert string Update string Read string Delete string Remove string Login string Logout string Other string }
func CrudTasks ¶
func CrudTasks() CrudTasksType
type CustomSelectQueryParamsType ¶ added in v0.5.0
type CustomSelectQueryParamsType struct { SelectQuery string `json:"selectQuery"` CountQuery string `json:"countQuery"` TableName string `json:"tableName"` ModelPointer interface{} `json:"modelPointer"` QueryPositionalFieldValues []interface{} `json:"queryPositionalFieldValues"` CrudParams CrudParamsType `json:"crudParams"` CrudOptions CrudOptionsType `json:"crudOptions"` }
type DbConfig ¶
type DbConfig struct { DbType string `json:"dbType"` Host string `json:"host"` Username string `json:"username"` Password string `json:"password"` DbName string `json:"dbName"` Filename string `json:"filename"` Location string `json:"location"` Port uint32 `json:"port"` PoolSize uint `json:"poolSize"` Url string `json:"url"` Timezone string `json:"timezone"` SecureOptions DbSecureType `json:"secureOptions"` Options DbConnectOptions `json:"options"` PermitDBUrl bool `json:"permitDBUrl"` }
type DbConfigType ¶
type DbConfigType struct { Host string `json:"host"` Username string `json:"username"` Password string `json:"password"` DbName string `json:"dbName"` Filename string `json:"filename"` Location string `json:"location"` Port uint32 `json:"port"` DbType string `json:"dbType"` PoolSize uint `json:"poolSize"` Url string `json:"url"` SecureOption DbSecureType `json:"secureOption"` }
type DbConnectOptions ¶
type DbConnectOptions map[string]interface{}
type DbConnectionType ¶
type DbSecureType ¶
type DeleteCrudParamsType ¶
type DeleteCrudParamsType struct { CrudParams CrudParamsType CrudOptions CrudOptionsType GetTableFields []string TableFieldPointers []interface{} AuditLog bool }
type DeleteError ¶
type DeleteError ErrorType
type DeleteLogger ¶
type DeleteLogger interface {
DeleteLog(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
}
type DeleteLoggerx ¶
type DeleteLoggerx interface {
DeleteLog(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
}
type DeleteParamsType ¶
type DeleteParamsType struct { UserInfo UserInfoType `json:"userInfo"` RecordIds []string `json:"recordIds"` QueryParams QueryParamType `json:"queryParams"` }
type DeleteQueryError ¶
type DeleteQueryError ErrorType
type DeleteQueryObject ¶
type DeleteQueryObject struct { DeleteQuery string FieldValues []interface{} WhereQuery WhereQueryObject }
type DeleteQueryResult ¶
type DeleteQueryResult struct { DeleteQueryObject DeleteQueryObject Ok bool Message string }
func ComputeDeleteQueryById ¶
func ComputeDeleteQueryById(tableName string, recordId string) DeleteQueryResult
ComputeDeleteQueryById function computes delete SQL scripts by id(s)
func ComputeDeleteQueryByIds ¶
func ComputeDeleteQueryByIds(tableName string, recordIds []string) DeleteQueryResult
ComputeDeleteQueryByIds function computes delete SQL scripts by id(s)
func ComputeDeleteQueryByParam ¶
func ComputeDeleteQueryByParam(tableName string, queryParam QueryParamType) DeleteQueryResult
ComputeDeleteQueryByParam function computes delete SQL scripts by parameter specifications
type EmailAddressType ¶
type EmailUserNameType ¶
func EmailUsername ¶
func EmailUsername(loginName string) EmailUserNameType
EmailUsername processes and returns the loginName as email or username
type FieldValueType ¶
type FieldValueType interface{}
type GetCrudParamsType ¶
type GetCrudParamsType struct { CrudParams CrudParamsType CrudOptions CrudOptionsType GetTableFields []string TableFieldPointers []interface{} AuditLog bool }
type GetParamsType ¶
type GetParamsType struct { UserInfo UserInfoType `json:"userInfo"` Skip int `json:"skip"` Limit int `json:"limit"` RecordIds []string `json:"recordIds"` QueryParams QueryParamType `json:"queryParams"` SortParam SortParamType `json:"sortParams"` ProjectParam ProjectParamType `json:"projectParam"` }
type GetResultType ¶
type GetResultType struct { Records []map[string]interface{} `json:"records"` Stats GetStatType `json:"stats"` LogRes mcresponse.ResponseMessage `json:"logRes"` TaskType string `json:"taskType"` }
type GetStatType ¶
type LogParam ¶
LogParam interfaces / types
func (LogParam) AuditLog ¶
func (log LogParam) AuditLog(logType, userId string, options AuditLogOptionsType) (mcresponse.ResponseMessage, error)
func (LogParam) CreateLog ¶
func (log LogParam) CreateLog(table string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
func (LogParam) CustomLog ¶ added in v0.6.0
func (log LogParam) CustomLog(params AuditParamsType) (mcresponse.ResponseMessage, error)
func (LogParam) DeleteLog ¶
func (log LogParam) DeleteLog(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
func (LogParam) LoginLog ¶
func (log LogParam) LoginLog(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error)
func (LogParam) LogoutLog ¶
func (log LogParam) LogoutLog(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error)
func (LogParam) ReadLog ¶
func (log LogParam) ReadLog(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
func (LogParam) UpdateLog ¶
func (log LogParam) UpdateLog(tableName string, logRecords interface{}, newLogRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
type LogParamX ¶
LogParamX interfaces / types
func (LogParamX) AuditLog ¶
func (log LogParamX) AuditLog(logType, userId string, options AuditLogOptionsType) (mcresponse.ResponseMessage, error)
func (LogParamX) CreateLogx ¶
func (log LogParamX) CreateLogx(table string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
func (LogParamX) CustomLog ¶ added in v0.6.0
func (log LogParamX) CustomLog(params AuditParamsType) (mcresponse.ResponseMessage, error)
func (LogParamX) DeleteLogx ¶
func (log LogParamX) DeleteLogx(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
func (LogParamX) LoginLogx ¶
func (log LogParamX) LoginLogx(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error)
func (LogParamX) LogoutLogx ¶
func (log LogParamX) LogoutLogx(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error)
func (LogParamX) ReadLogx ¶
func (log LogParamX) ReadLogx(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
func (LogParamX) UpdateLogx ¶
func (log LogParamX) UpdateLogx(tableName string, logRecords interface{}, newLogRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
type LogRecordsType ¶
type LogRecordsType struct { LogRecords interface{} `json:"logRecords"` QueryParam QueryParamType `json:"queryParam"` RecordIds []string `json:"recordIds"` TableFields []string `json:"tableFields"` TableRecords []interface{} `json:"tableRecords"` }
type MessageObject ¶
type ModelOptionsType ¶
type MultiUpdateQueryResult ¶
type MultiUpdateQueryResult struct { UpdateQueryObjects []UpdateQueryObject Ok bool Message string }
func ComputeUpdateQuery ¶
func ComputeUpdateQuery(tableName string, actionParams ActionParamsType) MultiUpdateQueryResult
ComputeUpdateQuery function computes update SQL script. It returns updateScript, updateValues []interface{} and/or err error
type OkResponse ¶
type OkResponse struct {
Ok bool `json:"ok"`
}
type Profile ¶
type Profile struct { BaseModelType UserId string `json:"userId"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` Middlename string `json:"middlename"` Phone string `json:"phone"` Emails interface{} `json:"emails"` // slice of EmailAddressType OR EmailAddresses type RecEmail string `json:"recEmail"` RoleId string `json:"roleId"` DateOfBirth time.Time `json:"dateOfBirth"` TwoFactorAuth bool `json:"twoFactorAuth"` AuthAgent string `json:"authAgent"` AuthPhone string `json:"authPhone"` PostalCode string `json:"postalCode"` }
type ProjectParamType ¶
type QueryParamType ¶
type QueryParamType map[string]interface{}
type ReadLogger ¶
type ReadLogger interface {
ReadLog(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
}
type ReadLoggerx ¶
type ReadLoggerx interface {
ReadLog(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
}
type RelationBaseModelPtrType ¶
type RelationBaseModelPtrType struct { Description *string `json:"description" db:"description"` IsActive bool `json:"isActive" db:"is_active"` // => activate by modelOptionsType settings... CreatedBy *string `json:"createdBy" db:"created_by"` CreatedAt *time.Time `json:"createdAt" db:"created_at"` UpdatedBy *string `json:"updatedBy" db:"updated_by"` UpdatedAt *time.Time `json:"updatedAt" db:"updated_at"` }
type RelationBaseModelType ¶
type RelationBaseModelType struct { Description string `json:"description" db:"description"` IsActive bool `json:"isActive" db:"is_active"` // => activate by modelOptionsType settings... CreatedBy string `json:"createdBy" db:"created_by"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedBy string `json:"updatedBy" db:"updated_by"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
type RoleFuncType ¶
type RoleFuncType func(it1 string, it2 RoleServiceType) bool
type RoleServiceType ¶
type RoleServiceType struct { ServiceId string `json:"serviceId"` RoleId string `json:"roleId"` RoleIds []string `json:"roleIds"` ServiceCategory string `json:"serviceCategory"` CanRead bool `json:"canRead"` CanCreate bool `json:"canCreate"` CanUpdate bool `json:"canUpdate"` CanDelete bool `json:"canDelete"` CanCrud bool `json:"canCrud"` TableAccessPermitted bool `json:"tableAccessPermitted"` }
type SaveCrudParamsType ¶
type SaveCrudParamsType struct { CrudParams CrudParamsType CrudOptions CrudOptionsType CreateTableFields []string UpdateTableFields []string GetTableFields []string TableFieldPointers []interface{} AuditLog bool }
type SaveParamsType ¶
type SaveParamsType struct { UserInfo UserInfoType `json:"userInfo"` QueryParams QueryParamType `json:"queryParams"` RecordIds []string `json:"recordIds"` }
type SaveResultType ¶
type SaveResultType struct { QueryParam QueryParamType `json:"queryParam"` RecordIds []string `json:"recordIds"` RecordsCount int `json:"recordsCount"` TaskType string `json:"taskType"` LogRes mcresponse.ResponseMessage `json:"logRes"` }
type SelectQueryError ¶
type SelectQueryError ErrorType
type SelectQueryObject ¶
type SelectQueryObject struct { SelectQuery string FieldValues []interface{} WhereQuery WhereQueryObject }
type SelectQueryOptions ¶
type SelectQueryResult ¶
type SelectQueryResult struct { SelectQueryObject SelectQueryObject Ok bool Message string }
func ComputeSelectQueryAll ¶
func ComputeSelectQueryAll(modelRef interface{}, tableName string, options SelectQueryOptions) SelectQueryResult
ComputeSelectQueryAll compose select SQL script to retrieve all table-records. The query may be constraint by skip(offset) and limit options
func ComputeSelectQueryById ¶
func ComputeSelectQueryById(modelRef interface{}, tableName string, recordId string, options SelectQueryOptions) SelectQueryResult
ComputeSelectQueryById compose select SQL scripts by id
func ComputeSelectQueryByIds ¶
func ComputeSelectQueryByIds(modelRef interface{}, tableName string, recordIds []string, options SelectQueryOptions) SelectQueryResult
ComputeSelectQueryByIds compose select SQL scripts by ids
func ComputeSelectQueryByParam ¶
func ComputeSelectQueryByParam(modelRef interface{}, tableName string, queryParam QueryParamType, options SelectQueryOptions) SelectQueryResult
ComputeSelectQueryByParam compose SELECT query from the where-parameters
type SortParamType ¶
type TaskPermissionType ¶
type TaskPermissionType struct { Ok bool `json:"ok"` IsAdmin bool `json:"isAdmin"` IsActive bool `json:"isActive"` UserId string `json:"userId"` RoleId string `json:"roleId"` RoleIds []string `json:"roleIds"` RoleName string `json:"roleName"` RoleNames []string `json:"roleNames"` OwnerPermitted bool `json:"ownerPermitted"` }
TaskPermissionType for TaskPermission method value (interface{}) response, and to assert returned value
type UpdateError ¶
type UpdateError ErrorType
type UpdateLogger ¶
type UpdateLogger interface {
UpdateLog(tableName string, logRecords interface{}, newLogRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
}
type UpdateLoggerx ¶
type UpdateLoggerx interface {
UpdateLog(tableName string, logRecords interface{}, newLogRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
}
type UpdateQueryError ¶
type UpdateQueryError ErrorType
type UpdateQueryObject ¶
type UpdateQueryObject struct { UpdateQuery string FieldNames []string FieldValues []interface{} WhereQuery WhereQueryObject }
type UpdateQueryResult ¶
type UpdateQueryResult struct { UpdateQueryObject UpdateQueryObject Ok bool Message string }
func ComputeUpdateQueryById ¶
func ComputeUpdateQueryById(tableName string, actionParam ActionParamType, recordId string) UpdateQueryResult
ComputeUpdateQueryById function computes update SQL scripts by recordId. It returns updateScript, updateValues []interface{} and/or err error
func ComputeUpdateQueryByIds ¶
func ComputeUpdateQueryByIds(tableName string, actionParam ActionParamType, recordIds []string) UpdateQueryResult
ComputeUpdateQueryByIds function computes update SQL scripts by recordIds. It returns updateScript, updateValues []interface{} and/or err error
func ComputeUpdateQueryByParam ¶
func ComputeUpdateQueryByParam(tableName string, actionParam ActionParamType, queryParam QueryParamType) UpdateQueryResult
ComputeUpdateQueryByParam function computes update SQL scripts by queryParams. It returns updateScript, updateValues []interface{} and/or err error
type UserInfoType ¶
type UserInfoType struct { UserId string `json:"userId" form:"userId" mcorm:"user_id"` Firstname string `json:"firstname" mcorm:"firstname"` Lastname string `json:"lastname" mcorm:"lastname"` Language string `json:"language" mcorm:"language"` LoginName string `json:"loginName" form:"loginName" mcorm:"login_name"` Token string `json:"token" mcorm:"token"` Expire int64 `json:"expire" mcorm:"expire"` Email string `json:"email" form:"email" mcorm:"email"` Username string `json:"username" form:"username" mcorm:"username"` RoleId string `json:"roleId" mcorm:"role_id"` }
type ValidateResponseType ¶
type ValidateResponseType struct { Ok bool `json:"ok"` Errors MessageObject `json:"errors"` }
type ValueToDataType ¶
type ValueToDataType map[string]interface{}
type WhereQueryError ¶
type WhereQueryError ErrorType
type WhereQueryObject ¶
type WhereQueryObject struct { WhereQuery string FieldValues []interface{} }
type WhereQueryResult ¶
type WhereQueryResult struct { WhereQueryObject WhereQueryObject Ok bool Message string }
func ComputeWhereQuery ¶
func ComputeWhereQuery(queryParams QueryParamType, fieldLength int) WhereQueryResult
ComputeWhereQuery function computes the multi-cases where-conditions for crud-operations