本文整理匯總了Golang中github.com/quintans/goSQL/db.Table.GetName方法的典型用法代碼示例。如果您正苦於以下問題:Golang Table.GetName方法的具體用法?Golang Table.GetName怎麽用?Golang Table.GetName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/quintans/goSQL/db.Table
的用法示例。
在下文中一共展示了Table.GetName方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: SoftDeleteByIdAndVersion
func SoftDeleteByIdAndVersion(DB db.IDb, table *db.Table, id int64, version int64) error {
deletion := table.GetDeletionColumn()
if deletion == nil {
return dbx.NewPersistenceFail("DAOUtils.SoftDeleteByIdAndVersion", "Table "+table.GetName()+" does not have a deletion type column to do a soft delete.")
}
keyColumn := table.GetKeyColumns().Enumerator().Next().(*db.Column)
versionColumn := table.GetVersionColumn()
result, err := DB.Update(table).
Set(deletion, tk.Milliseconds()).
Set(versionColumn, version+1).
Where(
keyColumn.Matches(id),
versionColumn.Matches(version),
).
Execute()
if err != nil {
return err
}
if result == 0 {
return dbx.NewOptimisticLockFail("DAOUtils.removeByIdVersion: Unable to soft delete by id and version for the table " + table.GetName())
}
return nil
}
示例2: TableName
// FROM
func (this *GenericTranslator) TableName(table *db.Table) string {
return table.GetName()
}
示例3: TableName
func (this *FirebirdSQLTranslator) TableName(table *db.Table) string {
return "\"" + strings.ToUpper(table.GetName()) + "\""
}
示例4: TableName
func (this *MySQL5Translator) TableName(table *db.Table) string {
return "`" + strings.ToUpper(table.GetName()) + "`"
}
示例5: TableName
func (this *OracleTranslator) TableName(table *db.Table) string {
return "\"" + strings.ToUpper(table.GetName()) + "\""
}
示例6: TableName
func (this *PostgreSQLTranslator) TableName(table *db.Table) string {
return strings.ToLower(table.GetName())
}
示例7: DeleteByIdAndVersion
func DeleteByIdAndVersion(DB db.IDb, table *db.Table, id int64, version int64) error {
logger.CallerAt(1).Debugf("DAOUtils.removeByIdVersion: id: %v, version: %v", id, version)
keyColumn := table.GetKeyColumns().Enumerator().Next().(*db.Column)
versionColumn := table.GetVersionColumn()
result, err := DB.Delete(table).
Where(
keyColumn.Matches(id),
versionColumn.Matches(version),
).
Execute()
if err != nil {
return err
}
if result == 0 {
return dbx.NewOptimisticLockFail("DAOUtils.removeByIdVersion: Unable to delete by id and version for the table " + table.GetName())
}
return nil
}