public Task <bool> InsertOrUpdateAsync(VisitedModel model) { return(InsertOrUpdateAsync(model, null)); }
private async Task <bool> InsertOrUpdateAsync(VisitedModel model, IDbTransaction transaction) { var sql = "INSERT INTO t_visit_history (infohash_id, user_id, visit_time) VALUES (@hashId,@userId,current_timestamp) ON CONFLICT (infohash_id,user_id) DO UPDATE SET visit_time=current_timestamp;"; return(await Connection.ExecuteAsync(sql, new { userId = model.UserId, hashId = model.HashId }, transaction) > 0); }