# Functions
No description provided by the author
func CreateUpdateStatement(data interface{}, tableName string, excludeFields []string) (string, error) {
// Get the type of the struct
dataType := reflect.TypeOf(data)
// Create the UPDATE statement
updateStmt := fmt.Sprintf("UPDATE %s SET ", tableName)
// Iterate over the fields of the struct
for i := 0; i < dataType.NumField(); i++ {
field := dataType.Field(i)
// Check if the field should be excluded
if Contains(excludeFields, field.Name) {
continue
}
// Add the field to the UPDATE statement
updateStmt += fmt.Sprintf("%s = ?, ", field.Name)
}
// Remove the trailing comma and space
updateStmt = strings.TrimSuffix(updateStmt, ", ")
// Add the WHERE clause
updateStmt += "WHERE id = ?"
return updateStmt, nil
}
*/.
No description provided by the author
No description provided by the author
return bool if string is taken in a table - table: table to check - value: value to check - field: field to check - exclusionField: field to exclude i.e.
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author