reinaldyrfl
Explore posts from serversDTDrizzle Team
•Created by reinaldyrfl on 4/9/2024 in #help
How do I execute raw query (with params already separated) with Drizzle?
Okay, so I've made my own query builder beforehand and I'm migrating away my code from raw postgres-js nature to Drizzle ORM (since I don't really want to parse stuff around anymore like what I would need to be doing with just raw postgres-js. On usual postgres-js, what I'd do is just:
In which
query
is a string
and params
is a unknown[]
. I wanted to execute this with Drizzle, but I haven't find the right way to do so. Even using the sql
template literals or even building my own implementation for SQLWrapper
interface (source) doesn't seem right to me. Is there any other way for me to execute the code directly without drifting away from the drizzle db instance (that's wrapping the original postgres-js
instance)?4 replies
✅ Passing realtime data from Worker to ASP.NET Web API
I'm working on a stock broker company, currently working for the stock chart infrastructure. I need to connect to the realtime data feed server via a single TCP socket (the server's using C++), and fan out the stocks data in realtime via WebSocket to the frontend client (which is just static HTML/JS also statically served by ASP.NET Core).
One thing that bugs me and the team is: how do we properly transfer the data from the Worker instance to the Web API instance, so that it can be properly being fan out? At first I was thinking of using
System.Threading.Channels
, but having it as a singleton that used by both the Web API and Worker doesn't makes sense to me, as I suppose the class will be created twice on the Web API and on Worker (or did I got it wrong?).
I don't want to add another external infrastructure like using Kafka, Rabbit, or Redis pubsub, I want to avoid more latency.
So the questions would be:
1. How do I properly transfer (and possibly fan out) the data being consumed by Worker instance to the ASP.NET Core instance?
2. Is using System.Threading.Channels
the best way to achieve this? On other language, I'd use channel
in Go and std::sync::mpsc
in Rust.6 replies
✅ How do you create custom authz/autho in ASP.NET Core?
As far as I know, on the internet there's only an implementation for JWT authentication. Yet, I need totally custom implementation that's not related to JWT at all.
I have an additional case that every static file visit should also be authenticated (the specification said so).
According to my implementation, anonymous access should be allowed. But for unknown reasons, I got empty content with 401 status code for any page and any method.
I think I'm missing something, yet I don't know what it is.
21 replies