random method

  1. @override
Future<T?> random([
  1. String? tableName
])
override

随机获取一个数据

Implementation

@override
Future<T?> random([String? tableName]) async {
  List<T> items = await query(tableName: tableName, orderBy: "RANDOM()", limit: 1);
  return items.isNotEmpty ? items.first : null;
}