SQLc is the perfect tool for those who don't like ORMs

  Рет қаралды 105,024

Dreams of Code

Dreams of Code

Күн бұрын

Пікірлер: 289
@dreamsofcode
@dreamsofcode Ай бұрын
Click this link sponsr.is/bootdev_dreamsofcode and use my code DREAMSOFCODE to get 25% off your first payment for boot.dev. That’s 25% off your first month or your first year, depending on the subscription you choose.
@NickTheCodeMechanic
@NickTheCodeMechanic Ай бұрын
I NEVER use protection.
@CppExpedition
@CppExpedition Ай бұрын
please wait a little bit longer for us to read code instead switching to your face xD
@edhahaz
@edhahaz Ай бұрын
the ORM/SQL guy's laptop of choice is inverted for engagement baiting.
@r0ny539
@r0ny539 Ай бұрын
i wanted to say same thing
@astronemir
@astronemir Ай бұрын
No just admit you’re an SQL normie. Embrace the label 🐑. 😂😂😂
@devOnHoliday
@devOnHoliday Ай бұрын
missed the banana cursor
@fresonn
@fresonn Ай бұрын
I have been using sqlc for two years now. It is definitely one of the best tools for interacting with a database.
@AbegazNap
@AbegazNap Ай бұрын
was not friendly with arguments inside case statements so I switched to go jet, but yes one of the best in the biz as they say
@HierImNorden
@HierImNorden Ай бұрын
We decided to use sqlc a couple months ago and it is the best tool we have found, but I have two gripes with it: 1. You cannot easily create a drop in replacement interface for two different engines. We wanted to use PG in production and SQlite for testing. Even though the generated types etc are entirely identical they are, at the end of the day, different types. So what we did was write a hacky python script that copies all the parameters and models into a common package and updates the references in the subpackages. It works, but a native way for this would be nice. 2. It bleeds sql types. Every nullable column turns into a sql.NullXXX field instead of, say, a *string. If I wrote the repository myself, I would convert that to normal types before passing it along, but I have not found a way to do that with sqlc so far.
@eyob7232
@eyob7232 29 күн бұрын
You can add a `emit_pointers_for_null_types:true` property to solve your second issue, not sure for your first one though,
@benwoodward3446
@benwoodward3446 27 күн бұрын
Why not use pglite? Or postgres via testcontainers?
@じょえさん
@じょえさん 21 күн бұрын
Bro, To quote from The Twelve-factor App, the development and production environments should match as much as possible.
@mantovani96
@mantovani96 Ай бұрын
The only thing missing is a better way to handle queries with dynamic parameters.
@sarabwt
@sarabwt Ай бұрын
to-many joins?
@RumenNikiforov
@RumenNikiforov Ай бұрын
Exactly, i'd like to see how you can have one func that supports conditional filtering e.g. find all players based on their class, or have particular item, or have gold above or below certain value. And full text search with ordering based on query relevance e.g. in postgres column 'value'
@TheNamakool
@TheNamakool Ай бұрын
Yep this hurts the most for endpoints that need to apply lots of optional filters
@AbegazNap
@AbegazNap Ай бұрын
@@TheNamakool you can try case when statements with associated booleans to check if the filters are provided since zero values might be a problem
@meni181818
@meni181818 Ай бұрын
you can mock it with weird sql case.. conditions etc.
@bryanleebmy
@bryanleebmy Ай бұрын
Funny how sqlc requires a whole other set of abstractions like sqlc.arg(parameter), making it arguably just as complicated and proprietary as other ORMs
@OverG88
@OverG88 Ай бұрын
@@bryanleebmy That’s why I use Jet.
@rodrigomaximilianobellusci8860
@rodrigomaximilianobellusci8860 29 күн бұрын
@@OverG88 what’s that?
@OverG88
@OverG88 29 күн бұрын
@@rodrigomaximilianobellusci8860 It’s a type safe SQL library for Go.
@hagenvolpers390
@hagenvolpers390 28 күн бұрын
Tbh I don‘t get your point here. An ORM is a runtime dependency, a lib you have to keep track of and hope that someone continues to maintain it. Sqlc is just a code generator to simplify your workflow. If no one continues to maintain it or you want to get rid of it you just stop using it and fallback to write it yourself (starting point of the vid). Just because you use ChatGPT and copy generated code into your app doesn‘t mean your app depends on ChatGPT or features AI…
@spartan_j117
@spartan_j117 25 күн бұрын
@@OverG88 go-jet is a fantastic tool, the killer feature. I wonder why it is still not the most popular and eventually the standard way to work with SQL.
@endalk200
@endalk200 Ай бұрын
Very interested in seeing your go backend development stack
@jefferymuter4659
@jefferymuter4659 Ай бұрын
Damn this is perfect! I've heard of sqlc, but didn't understand it. I've also been writing all my own code for this, and its been making me feel super sluggish. Thank you for showing me this!
@ericwanyoike-h9l
@ericwanyoike-h9l Ай бұрын
sqlc is just a must use tool to use with databases
@timo_b3
@timo_b3 Ай бұрын
this looks extremely interesting, thanks for showing this
@couch9416
@couch9416 Ай бұрын
I am on vacation and wanted to look into sqlc for a project when I am back, so this is perfect timing
@demarcorr
@demarcorr Ай бұрын
wth i was just at trader joes and they do NOT sell SQL spice. Absolutely livid
@L0wPressure
@L0wPressure Ай бұрын
Amazing :) We were just talking with a colleague, how we hate codegen, but this tool actually looks nice!
@erikslorenz
@erikslorenz Ай бұрын
If you spend 5 years having to almost exclusively use 3rd party APIs (poorly documented) instead of traditional DBs, any opportunity to use SQL directly is a dream.
@Darthtrooper14
@Darthtrooper14 Ай бұрын
You convinced me to try sqlc. Thanks for showing us this!!
@ErmandDurro
@ErmandDurro Ай бұрын
Great video. I didn't know about sqlc, but I am definitely going to try it now. Thanks a lot for such great quality content. And yes, I would love to have that video about your backend stack :) Thanks once again!
@05xpeter
@05xpeter Ай бұрын
As a developer that constantly have to stop my self from writing raw sql queries, this look amazing. We have a cross language platfrom Python and Typescript maaaaaybe I could sneak it in make our code base a little dry'er.
@recarsion
@recarsion Ай бұрын
The BTW part really got me 💀Very relevant video as well, I'm using something called SQLBoiler right now which is one of the better ORMs I've used but I'm still feeling the limitations on a day to day basis especially any time joins are needed so I either end up writing a raw query anyway or querying each table one by one and joining manually, at which point why even use an ORM, or a relational database for that matter... luckily I'm at the point where I can still make a big change like this so I'm fairly sure I'll be converting to sqlc. Edit: and I did it already in a couple hours, it went pretty smooth actually (not surprising for a small application like mine) and I'm finding this really easy to use and elegant so far
@cg219
@cg219 Ай бұрын
Also I love sqlc. It was the first option I chose when switching to Go. Great choice I see
Ай бұрын
Again, thank you for your work! I've tried to convince some people on my team to use sqlc, they were not fully convinced despite my fantastic persuasion techniques. Guess I'll just share this video so they can finally understand what I extremely articulately tried to say/show at the time xD
@spartan_j117
@spartan_j117 25 күн бұрын
Take a look into go-jet/jet. It is really fantastic, true type safe way to write sql. The thing that author shows in this video is just as retarded as any other. Jet is the future.
@tkg__
@tkg__ Ай бұрын
The only gripe I have with it is that it creates a non-standard SQL. The sqlc.embed() for example makes the SQL query not actually SQL, which was the whole point of using sqlc and not an ORM.
@AK-vx4dy
@AK-vx4dy Ай бұрын
Those queries templates not literal queries. I know most libraries for SQLs provide replacing $1 or :amount with provided parameters but it this any diffrent ? But you are right is should be orthogonal and specfics about arguments shoud be done like comment $1/*amount::bigint*/.
@dealloc
@dealloc Ай бұрын
It's valid SQL syntax which is important to note. Just as valid as using different SQL flavor depending on which SQL engine you use. This engine just happens to go through sqlc before being passed onto your database directly. Consider the SQL being executed within a runtime that has a preprocessor that simply replaces those calls during execution. This is why they are called macros, because they are exactly that.
@31redorange08
@31redorange08 Ай бұрын
Yeah, kind of defeats its purpose.
@theseangle
@theseangle Ай бұрын
Bro it's a macro, it produces the same SQL you would've written without it. That's the whole point. And you aren't even forced to use it, nobody's stopping you from raw dogging the conflicting column names and writing boilerplate. It's just QoL. The main purpose of SQLc is to strike a balance between DX and control, and it does hit the spot quite well. You also aren't forced to opt in fully, you can use it for part of your queries, it doesn't affect the schema (unlike ORMs), you can still use regular SQL or other tools with it.
@31redorange08
@31redorange08 Ай бұрын
@@theseangle What so you mean by "produces"? If I can't take the string literally and execute it directly, it's not valid SQL.
@TheKastellan
@TheKastellan Ай бұрын
7:30 *Woosh. Woosh. Woosh. Woosh*
@MichaelCampbell01
@MichaelCampbell01 Ай бұрын
For real; quite distracting. Otherwise great content, too.
@michawhite7613
@michawhite7613 Ай бұрын
There's a Rust library called sqlx, which uses the language's macro system to verify SQL commands against your local database at compile-time, and it generates a compiler error if it fails.
@tekipeps
@tekipeps Ай бұрын
@@michawhite7613 yeah the original library is sqlx from golang
@dreamsofcode
@dreamsofcode Ай бұрын
I have a video on sqlx! I'm a big fan of it.
@sitedel
@sitedel Ай бұрын
ORM libraries have several advantages over sqlc. It is easier to use a different target (in-memory) database to speed up integration tests. They include several levels of caching to avoid running the same queries at high rates when data is not changing so often. They manage relationships quite well, especially when caching is enabled: data is loaded only when needed. They facilitate the integration of data encryption and decryption with a column based approach. They may include a validation step which prevent storing incoherent data like an off limit value. They can manage the update and validation of database schema, which is useful for A/B deployments where two releases of the same application can coexist for some time before discarding one of them.
@kianyanglee4618
@kianyanglee4618 25 күн бұрын
Any ORM you would recommend?
@sitedel
@sitedel 24 күн бұрын
@@kianyanglee4618 Hibernate is the de-fscto standard and includes all features, Eclipselink is a strong contender too if your main use is to provide REST of Web services to access a database. ORM is considered overkill for mobile applications.
@TheRykung
@TheRykung Ай бұрын
perfect timing video lol I was looking into sqlc last night. wasn't sure if I wanted to just go with the standard go database/sql package or use sqlc
@mikaeels2691
@mikaeels2691 Ай бұрын
this is what the squirrel library for Gleam does which is pretty cool, except that one only supports postgres for now
@herbertpimentel
@herbertpimentel Ай бұрын
I would love to see more about it.
@esra_erimez
@esra_erimez Ай бұрын
The company I work for tried sqlc, they contributed to the project both with code and funding. Its missing a lot of features. For example, dynamic quueries. Its been an open issue on the issue tracker for *years* now. We moved on to xo.
@lambertm9837
@lambertm9837 Ай бұрын
I second this
@lifelover69
@lifelover69 Ай бұрын
i learned a lot and i'm going to try sqlc now, thanks! squeal ftw
@flameinthedark
@flameinthedark Ай бұрын
There are also some inconvenience with this tool, it's impossible to make some filtering requests. For example if you have a search route in your API and you have to insert some WHERE statements in the SQL request. Like, select rows with "active = true" when user set that checkbox, and other filters. But yeah, in general this tool is very cool, and I've used it in the production, but had to switch to plain SQL or something like squirrel to be able to build more flexible requests
@AK-vx4dy
@AK-vx4dy Ай бұрын
Are you sure ? You can add WHERE in query with parameted $1 like "WHERE active=$1"
@someoneunknown6894
@someoneunknown6894 Ай бұрын
​@@AK-vx4dyI think he means that unless the checkbox is set, you are ok with both active being true and active being false, otherwise you only want to get the active entires
@dealloc
@dealloc Ай бұрын
First, you know the filters that may or may not be applied, so build the query with those in mind up front. Don't concatenate query strings to form a query dynamically, instead encode the filters into the query itself: For example `SELECT * FROM table WHERE (@name IS NULL OR name LIKE @name) AND (@age IS NULL OR age = @age) AND (@active IS NULL OR active = @active) ...` This gives you the freedom to choose how filters are applied in compound. The benefit of this is that the execution plan can be cached and re-used no matter what inputs are, so there's practically zero overhead unlike stitching random queries together which may be different each time
@orterves
@orterves Ай бұрын
​@dealloc you beat me to it - this is correct, and the other style of code that tacks on extra sql is harder to maintain. An alternative to doing it this way would be to make multiple queries with different where clauses and choosing which one conditionally in the code
@AK-vx4dy
@AK-vx4dy Ай бұрын
@@orterves If you need to be so elastic (user provided filtering), indeed good(!) orm can be a better choice. But.. I'm not sure but maybe is possible to add sql.embbed(whole_where_section) and bulit this part in code ?
@sagarrout007
@sagarrout007 Ай бұрын
I am not sure for go but for Java developers, Jdbi brings this thing with more nicer abstraction as well
@tienslabien
@tienslabien Ай бұрын
oh good catch, I didn't know about JDBI, thanks for sharing
@Metruzanca
@Metruzanca Ай бұрын
Oh shit, hopefully a Gleam plugin gets made. Maybe I'll give it a shot.
@SteveKuznetsov
@SteveKuznetsov Ай бұрын
Consider using bingo to declaratively manage the version of SQL binary you're using at a project level. This is very nice to make the build time environment reproducible for anyone cloning the repair and also to manage the version of the tools in git.
@ViktorKrejcir
@ViktorKrejcir Ай бұрын
That looks cool :) I'll try it tonight before I Hibernate :)
@anothercrappypianist
@anothercrappypianist Ай бұрын
I'm definitely won over by the prospect of less boilerplate, but my first thought was "how does it deal with transient db failures?" After looking through the GitHub issues, unfortunately the answer seems to be be "not very well." There's no explicit retry mechanism, and there's currently no means of adding custom middleware through which to implement common retry logic. So AFAICT implementing retries means wrapping calls, which replaces one kind of boilerplate with another.
@SaltCatcher
@SaltCatcher Ай бұрын
I want to see a video about your complete go stack!
@yash1152
@yash1152 28 күн бұрын
0:03 framework systems for the win yayy!!
@youssefgamal4625
@youssefgamal4625 Ай бұрын
In Java Spring Boot there is a solution for db first called JOOQ, it's impressive for any spring boot development
@tienslabien
@tienslabien Ай бұрын
I went with querydsl, which is a similarly-minded api. Way lighter and clearer code than jpa/hibernate, whilst also having access to the full sql spec and db-specific dialect operations (try writing a dynamic join or an INSERT SELECT ... query with jpa ... lmao)
@distinctdipole
@distinctdipole Ай бұрын
Thank you... for clearly explaining this helpful tool and for the moments that made me chuckle 🤭
@committedcoder3352
@committedcoder3352 Ай бұрын
Would love to see you talking about the migrations.
23 күн бұрын
Without dynamic queries it was of no use... at least for my projects: p Nice video btw.
@Jafeth636
@Jafeth636 Ай бұрын
Did I see Zen Browser? LET'S GO!
@RedPsyched
@RedPsyched Ай бұрын
We have the same cursor! All hail the banana cursor 🙇
@felizadoxi
@felizadoxi Ай бұрын
Yes, please show us your full stack
@temperkan3727
@temperkan3727 Ай бұрын
Very useful video!
@charleschen4093
@charleschen4093 Ай бұрын
love your sharing!
@MisraPreetiman
@MisraPreetiman Ай бұрын
Bananas near anything related to code/coding always remind me of Joy of Code
@johnbauer9907
@johnbauer9907 Ай бұрын
Very well done video... Thanks.
@AK-vx4dy
@AK-vx4dy Ай бұрын
select * is generally bad practice but in this case when total control of database is asssumed, i can grant absolution ;)
@noadsplease2737
@noadsplease2737 Ай бұрын
I’ve never understood this false dichotomy of ORM vs Raw SQL. I’ve used a number of database abstraction layers that are not ORMs but don’t force you to write SQL either. They lean toward relational semantics making the code more like “writing SQL in Python” than “writing Python and pretending that the database is a big hash map” (mapping objects to relations).
@NostraDavid2
@NostraDavid2 Ай бұрын
Shout out to SQLAlchemy, which can do this! It's pretty nice!
@noadsplease2737
@noadsplease2737 Ай бұрын
@@NostraDavid2 yes the “low level” stuff in SQLAlchemy is totally inline with what I mean. I’m more of a PyDAL guy myself but when/where I can’t use it I’ve used SQLAlchemy and refuse to do the ORMy type things that others use like a crutch for not understanding relational semantics
@tienslabien
@tienslabien Ай бұрын
that's the query builder pattern and it's what I also like best
@JaJDoo
@JaJDoo Ай бұрын
just a heads up here, sqlc is real nice and its future looks promising but still has issues with more complex queries and things like dynamic filters make sure you check the kinds of queries you have are possible in sqlc before committing to it
@MadsterV
@MadsterV Ай бұрын
Problem achieved! you've replaced boilerplate with even more boilerplate in two different uncommon languages!
@litfill54
@litfill54 Ай бұрын
the banana cursor
@dreamsofcode
@dreamsofcode Ай бұрын
Coming soon!
@duongphuhiep
@duongphuhiep Ай бұрын
skeptical! not sure if it makes things easier to debug and to maintain
@coolaj86
@coolaj86 Ай бұрын
Note: ossp-uuid should NOT be used for secure uuidv4 (the implementation details do not guarantee security). Instead gen_random_uuid() (from pgcrypto) should be used. HOWEVER, there are performance issues with all uuidv4 varations, and uuidv7 should be preferred (typically generated by the application on insert, but also available as a postgres function if default values are needed).
@herbert9039
@herbert9039 Ай бұрын
nice video, thanks! subscribed
@CoolestPossibleName
@CoolestPossibleName Ай бұрын
Finnally someone mentioned sqlc
@AntonGalitsyn
@AntonGalitsyn Ай бұрын
Looks nice, it can save some time. But I personally don't want to use it. 1st reason - I came in Go for simple setup, but now I forced to dive into code generation logic of 3-rd party tool and use yaml config, sql macroses ant etc. I would rather ask chatgpt/claude generate repository methods and provide it Go structs and SQL schemas I made, and keep it as non-generated code. 2nd reason - tests, I usually split storage layer into multiple EntityRepository parts and test them separately against DB in docker container. It's easier to modify code manually than try to find exact config combination needed for code gen tool. 3rd reason - Go structs not always repeat table columns. These "models" generated by sqlc is not models at all, it's more like helper mapping structs for DB driver. Models, if we use this term in paradigm of clean code, should be free of `db`, `json` tags and don''t have sql field types because this is abstraction leak. If we use pgx, we may have case when you need pgxtype fields for proper mapping, but it's not often. In many cases you can reuse your app level models with small addition of private (storage level) structs for mapping to specific type. Sqlc rely on generated models, not on models defined on app level by developer.
@tkg__
@tkg__ 17 күн бұрын
Go is and always was very heavily leaning into code generation. So it's not really out of its idiomatic approach. I'd prefer to configure it in Go rather than a YAML file, but that's all.
@Sim-rh4tj
@Sim-rh4tj Ай бұрын
ORMs can be great, right up until the moment they are completely blocking something sensible.
@mind.journey
@mind.journey Ай бұрын
@@Sim-rh4tj a good orm will always allow you to resort to raw queries though
@Sim-rh4tj
@Sim-rh4tj Ай бұрын
@@mind.journey true, but you don't always get to choose.
@shikyokira3065
@shikyokira3065 Ай бұрын
@@Sim-rh4tj You get to choose whatever you want when you write your own orm like myself. I knew building boilerplate is going to eat up a lot of my time so I invested 2-3 weeks of my time solely on building a working orm that supports multiple sql languages even those I'm not familiar with like SAP HANA (until I do while building support for it). Now the orm can even do something like tracking dozen of records in the database real time and then display them on a browser with minimal performance hit. The whole idea is to mimic firebase's real time data synchronization
@MrCatgroove
@MrCatgroove 29 күн бұрын
I'm sold on sqlc, but I don't think it's a 1:1 replacement for a repository/storage/db/whatever-layer. If you have pure domain models, you'd want to map to those inside of the db-layer before returning. The same goes if you have many-to-many relationships. It's simply not feasible to do all of that with just sqlc. The same goes for if you have dynamic queries. It's not really supported by sqlc in a good way and you will probably have to use something like strings.Builder allow for such queries,. You would want this code to live next to your other db-code. This approach also avoids macros (mostly) and keeps your queries very simple and straightforward.
@guerra_dos_bichos
@guerra_dos_bichos Ай бұрын
But for me the main advantage of writing your own SQL code is being able to use your preferred database specifics , like postgres jsonc etc
@djkim24601
@djkim24601 Ай бұрын
Thank you so much
@EduardKhiaev
@EduardKhiaev Ай бұрын
I really would like to see your tech stack and the reason why you are using certain tools instead of other tools, for example migrate and goose
@Sunpy_Emily
@Sunpy_Emily Ай бұрын
I can't focus on the video with the sound effect that is used on almost every zoom and underline edit.
@erictrinque6513
@erictrinque6513 Ай бұрын
we know whats really in that SQL-spice tin 👌 just a pinch will do in a clinch
@DerTim
@DerTim Ай бұрын
Im using sqlx and go migrator embedded into my app rn and I'm thinking about moving to sqlc + atlas. But there is one important feature missing to me: how can I migrate default data to my backend? E.g. I have a permissions table and I have certain base permissions. How can I migrate them? Should I use two different migration tools 🤔
@dreamsofcode
@dreamsofcode Ай бұрын
You can add default data into your migrations if you are guaranteed to need it!
@johnnydenver-m8r
@johnnydenver-m8r 29 күн бұрын
Every orm allows for raw sql queries which are mostly protected by default.
@AK-vx4dy
@AK-vx4dy Ай бұрын
"Strong raction" epic ;)
@dewigesrek5651
@dewigesrek5651 Ай бұрын
after seeing the docs, i’d rather create my own
@dewigesrek5651
@dewigesrek5651 Ай бұрын
but again, this is my case not urs
@Fran-kc2gu
@Fran-kc2gu Ай бұрын
waiting for your github repo link :)
@SriTejaChilakapati
@SriTejaChilakapati 29 күн бұрын
Hey, great video! However I seem to be facing an issue while overriding types of UUID columns that are a foreign key reference to another table. The primary key field is `uuid.UUID`, but the foreign key field is still `pgtype.UUID`. Any idea where I might be missing something?
@SriTejaChilakapati
@SriTejaChilakapati 29 күн бұрын
Btw I understand that I don't really need foreign keys if everything is a raw query and I can write joins myself, but I'm working with an existing schema here
@dreamsofcode
@dreamsofcode 29 күн бұрын
If you jump on my discord and drop me a message I can take a look! Will need to see what your schema and query look like otherwise. I've managed to get a FK reference to work fine with my join table before.
@tawandagamedevs
@tawandagamedevs Ай бұрын
Dreams of code video ❤
@vadzimpisaruk2333
@vadzimpisaruk2333 29 күн бұрын
Sqlx + bun is enough in 99% usecases and it’s way more simplistic
@Bliss467
@Bliss467 Ай бұрын
Eh feels like yet another technology to add to the overflowing tech stack that continues to overcomplicate Cicero
@JohanStrandOne
@JohanStrandOne Ай бұрын
ok you win You got me curious. What's your go dev stack?
@giorgioripani8469
@giorgioripani8469 Ай бұрын
How is this better than Spring JPA Repository named queries?
@dansouza1623
@dansouza1623 Ай бұрын
It would be interesting to see how well this plays with instrumentation (opentelemetry). Can sqlc generate instrumented boilerplate?
@Elkemper
@Elkemper 27 күн бұрын
That is very cool, but I think it's kinda mistake that they decided to stick with .sql extension. this is registered extension for DBMS-es and pure sql syntax. with all this new sugar from sqlc - it will make those query files unrunnable: you cannot easily debug them in the CLI or DB UI client, you need to traverse the file to understand how this works, etc.. other than that - pretty interesting approach. But do they have a LSP implementation?
@FroZZen98
@FroZZen98 Ай бұрын
>no c++, elixir and forth support
@triforce42
@triforce42 Ай бұрын
If you don't mind the feedback, could you reconsider the "whoosh" sound effect? I personally find it quite distracting.
@dreamsofcode
@dreamsofcode Ай бұрын
Thanks for the feedback! I'll pass this on to my editor
@kurt7020
@kurt7020 Ай бұрын
- Divorce the abstractions and marry postgresql. We did. It's been amazing. Cool tool though.
@duongphuhiep
@duongphuhiep Ай бұрын
so all your tests (and the pipeline CI which run them) are tightly coupled with postgresql?
@kurt7020
@kurt7020 Ай бұрын
@@duongphuhiep Yes.
@duongphuhiep
@duongphuhiep Ай бұрын
@@kurt7020 How do you manage tests isolation? each test will spin up a new fresh isolated databases. Or all tests shared the same database but are executed sequentially, and each test will clean up the mess before executing the next one. Or no isolation at all? same database, no clean up, a test might break other tests?
@kurt7020
@kurt7020 Ай бұрын
@@duongphuhiep There's a few ways to do it. You can run a db cluster with a test user roles that have privileges to create and drop databases its role owns. Each test can run the database init script to create a new database with a timestamp, a nonce, a commit hash or whatever, e.g: "my_db_testing_foo_1234" and do its thing. If the test passes your cleanup code can drop the entire test database. If the test fails, that db is kept - we want whatever it committed to help debugging. There's a lot of custom code. If you're working maintaining existing stuff, or constrained by upstream decisions on how you deploy, you may not have such a luxury. Good luck!
@kurt7020
@kurt7020 Ай бұрын
@@duongphuhiep A test user (postgresql role) creates its own database for a given test. You can do this in the test or in a pre-runner script. On success the database gets dropped. On failure the database persists to aid in debugging. Your test init script (or however you organize your tests) can name databases with nonces, and commit hashes, test names, timestamps, etc. It's in the same spirit as if you were testing on sqlite and deleting the test file when done. Creating and deleting databases on postgres is quite fast, relatively speaking if the test server is up and running. A lot of this depends on your environment and how you test/deploy. Best of luck!
@DerTechNick
@DerTechNick Ай бұрын
Nice idea, but this doesn't support any kind of dynamic order by clause, only static queries
@samuelborn9004
@samuelborn9004 Ай бұрын
Those Swoosh sounds when doing an animation are way to bassy and loud for my liking
@dreamsofcode
@dreamsofcode Ай бұрын
Thanks for the feedback!
@AdrianMunteanu92
@AdrianMunteanu92 21 күн бұрын
People still write single table queries in 2024. Meanwhile Oracle Siebel CRM does joins and nested queries since 99 declarative and with relatively high performance
@nomadtrails
@nomadtrails Ай бұрын
100% sold
@AlexGoldring
@AlexGoldring Ай бұрын
"I hate code generation". Uses TypeScript, a language that does JS code generation, running on V8 that does JS to IR to bytecode generation. Using SQL that does operation code generation in most DBs. Sure pal, sure.
@thestarks685
@thestarks685 Ай бұрын
Quick question what font and color scheme are you using ?
@timonyang
@timonyang Ай бұрын
possibly an unpopular opinion, but can you minimize the facecams or offset it to the side and show info/text instead? like your older videos. showing only facecam adds little to the context
@AlameenAdeyemi
@AlameenAdeyemi 14 күн бұрын
how do u handle validation if its setup this way? i don't wanna rewrite the structs just to add the bindings
@dreamsofcode
@dreamsofcode 3 күн бұрын
I usually handle validation above this layer, typically during the http handler.
@rign_
@rign_ Ай бұрын
I wrote code in Javascript. I usually use Kysely. It's query builder, I don't know if it's considered ORM or not...
@igalklebanov921
@igalklebanov921 Ай бұрын
not an ORM.. :)
@someshkarmakar47
@someshkarmakar47 Ай бұрын
we would love to know your GO full-stack.. please make a video on it
@seriousjan5655
@seriousjan5655 25 күн бұрын
Repository pattern does not help you with safety but with decoupling code. "Under" your "repository pattern" still needs to be some SQL so if you feed some unchecked strings or SQL engine will not handle this, you are screwed.
@rikschaaf
@rikschaaf Ай бұрын
Cool tool for languages that don't have generated repositories yet, or if you want to have queries that work in multiple languages. I usually prefer language-specific solutions though, like the repository interfaces in Spring Data JPA (Java), where you only have to specify the query and the abstract method and Spring will implement it for you. You can even have it generate the query based on the method name, which is nice for simple queries like findByFirstNameAndLastName, findByAmountGreaterThan, etc (you get findById, findAll, save and a couple others for free).
@kf5268
@kf5268 21 күн бұрын
Pani Szumlewicz w momencie dyskusji o ebookach i książkach ujawniła, że w sumie to jest solidnie poza tematem i włączyło jej sie coś na zasadzie pięćdziesięcioletniej polonistki, która się odkleiła i będzie w kółko mówić o tym co przeczytała i jakie książki są godne... Dalej dygresja o filozofii, z całym szacunkiem niczego nie udowadnia, poza tym, że wywołania pisane przez Panią wyprodukowała nie taki obrazek jaki oba sobie wyobrażała... 😅 Pani po prostu zupełnie nie rozumie tych konceptów co w sumie jest smutne w przypadku kogos kto zajmuję miejsce ekspera w takiej debacie
@theyioel
@theyioel Ай бұрын
What are your thoughts about SQLx and Turso/libSqlite if they come to the ecuation?
@FlaviusAspra
@FlaviusAspra 24 күн бұрын
SQLc sounds great, but it's missing a lot of things. I'm afraid they don't see enough of the picture to empower users to do a clean separation of concerns.
@christopherkim133
@christopherkim133 Ай бұрын
Could we get a look at that go stack?
@sascha1461
@sascha1461 Ай бұрын
oh i didn't know about this override thing. Gotta check if this works with mysql too :)
@stephensumpter5311
@stephensumpter5311 29 күн бұрын
Gave this a try just for funsies - overrides don't seem to actually work lol
@deckardcain9012
@deckardcain9012 Ай бұрын
Does anybody know what the Browser used in the B-Roll is called?
@M3MYS3LF1979
@M3MYS3LF1979 Ай бұрын
Think some other comments said it was zen browser. Which wildly enough, I hadn't heard of until today when watching the fireship video on the firefox zero day
@LongLiveEmrys
@LongLiveEmrys Ай бұрын
FYI the plugins for other languages are missing features and most of them don't appear to be active. I don't think you could feasibly use this tool for anything other than Go, unfortunately.
The embed package is a lot more useful than I originally thought...
16:56
DONT USE AN ORM | Prime Reacts
25:46
ThePrimeTime
Рет қаралды 237 М.
СОБАКА ВЕРНУЛА ТАБАЛАПКИ😱#shorts
00:25
INNA SERG
Рет қаралды 3,9 МЛН
Кто круче, как думаешь?
00:44
МЯТНАЯ ФАНТА
Рет қаралды 4,9 МЛН
MAD 2 Project Session - Support Session
39:31
MAD II
Рет қаралды 37
SQLModel + FastAPI: Say Goodbye to Repetitive Database Code
19:50
Using Dangerous AI, But Safely?
30:38
Robert Miles AI Safety
Рет қаралды 72 М.
Setting up a production ready VPS is a lot easier than I thought.
29:50
Microservices are Technical Debt
31:59
NeetCodeIO
Рет қаралды 633 М.
How is this Website so fast!?
13:39
Wes Bos
Рет қаралды 1 МЛН
This weird keyboard technique has improved the way I type.
17:04
Dreams of Code
Рет қаралды 45 М.
Google Drive hates developers now
23:56
Theo - t3․gg
Рет қаралды 157 М.
When Optimisations Work, But for the Wrong Reasons
22:19
SimonDev
Рет қаралды 1 МЛН
Does Deno 2 really uncomplicate JavaScript?
8:55
Beyond Fireship
Рет қаралды 458 М.
СОБАКА ВЕРНУЛА ТАБАЛАПКИ😱#shorts
00:25
INNA SERG
Рет қаралды 3,9 МЛН