diff --git a/content/blog/2022/10/2022-10-17_comparing-go-gorm-and-sqlx.rst b/content/blog/2022/10/2022-10-17_comparing-go-gorm-and-sqlx.rst new file mode 100644 index 0000000..1f9a4f4 --- /dev/null +++ b/content/blog/2022/10/2022-10-17_comparing-go-gorm-and-sqlx.rst @@ -0,0 +1,44 @@ +Comparing Go GORM and SQLX +########################## +:date: 2022-10-17 13:17 +:author: tyrel +:category: Tech +:tags: go, sql, python +:slug: comparing-go-gorm-and-sqlx +:status: draft + +Django ORM - My History +~~~~~~~~~~~~~~~~~~~~~~~ + +I'm not the best SQL developer, I know it's one of my weak points. +My history is I did php/mysql from the early 2000s until college. +In college I didn't really focus on the Database courses, the class selection didn't have many database course. +The one Data Warehousing course I had available, I missed out on because I was in England doing a study abroad program that semester. +My first job out of college was a Python/Django company - and that directed my next eight years of work. + +Django, if you are unaware, is a MVC framework that ships with a really great ORM. +You can do about 95% of your database queries automatically by using the ORM. + +.. code:: python + + entry, created = Entry.objects.get_or_create(headline="blah blah blah") + +.. code:: python + + q = Entry.objects.filter(headline__startswith="What") + q = q.filter(pub_date__lte=datetime.date.today()) + q = q.exclude(body_text__icontains="food") + +Above are some samples from the DjangoDocs. +But enough about Django. + +My Requirements +~~~~~~~~~~~~~~~ + +Recently at my job I was given a little bit of leeway on a project. +My team is sort of dissolving and merging in with another team who already does Go. +My Go history is building a CLI tool for the two last years of my `previous job. `_ +I had never directly interacted with a database from Go yet. +I wanted to spin up a REST API (I chose Go+Gin for that based on forty five seconds of Googling) and talk to a database. + + diff --git a/pelicanconf.py b/pelicanconf.py index 9982f54..5fe9b0c 100644 --- a/pelicanconf.py +++ b/pelicanconf.py @@ -50,11 +50,11 @@ STATIC_PATHS = ( ) ARTICLE_PATHS = ['blog', ] -ARTICLE_SAVE_AS = '{date:%Y}/{date:%M}/{slug}.html' -ARTICLE_URL = '{date:%Y}/{date:%M}/{slug}.html' +ARTICLE_SAVE_AS = '{date:%Y}/{date:%m}/{slug}.html' +ARTICLE_URL = '{date:%Y}/{date:%m}/{slug}.html' YEAR_ARCHIVE_SAVE_AS = 'posts/{date:%Y}/index.html' -MONTH_ARCHIVE_URL = 'posts/{date:%Y}/{date:%M}/index.html' +MONTH_ARCHIVE_URL = 'posts/{date:%Y}/{date:%m}/index.html' DEFAULT_METADATA = { diff --git a/tasks.py b/tasks.py index d36edf5..1171b1e 100644 --- a/tasks.py +++ b/tasks.py @@ -162,7 +162,7 @@ def new_post(c): :slug: {slug} :status: draft - """ +""" base = f"content/blog/{year}/{month}" os.makedirs(os.path.dirname(base), exist_ok=True) with open(f"{base}/{filename}", "w") as f: