fix dates
This commit is contained in:
parent
b8db611c29
commit
cdf77a095a
@ -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. <https://read.cv/tyrel/bl4Gp9PYIvGh54KSuhjr>`_
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
@ -50,11 +50,11 @@ STATIC_PATHS = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
ARTICLE_PATHS = ['blog', ]
|
ARTICLE_PATHS = ['blog', ]
|
||||||
ARTICLE_SAVE_AS = '{date:%Y}/{date:%M}/{slug}.html'
|
ARTICLE_SAVE_AS = '{date:%Y}/{date:%m}/{slug}.html'
|
||||||
ARTICLE_URL = '{date:%Y}/{date:%M}/{slug}.html'
|
ARTICLE_URL = '{date:%Y}/{date:%m}/{slug}.html'
|
||||||
|
|
||||||
YEAR_ARCHIVE_SAVE_AS = 'posts/{date:%Y}/index.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 = {
|
DEFAULT_METADATA = {
|
||||||
|
2
tasks.py
2
tasks.py
@ -162,7 +162,7 @@ def new_post(c):
|
|||||||
:slug: {slug}
|
:slug: {slug}
|
||||||
:status: draft
|
:status: draft
|
||||||
|
|
||||||
"""
|
"""
|
||||||
base = f"content/blog/{year}/{month}"
|
base = f"content/blog/{year}/{month}"
|
||||||
os.makedirs(os.path.dirname(base), exist_ok=True)
|
os.makedirs(os.path.dirname(base), exist_ok=True)
|
||||||
with open(f"{base}/{filename}", "w") as f:
|
with open(f"{base}/{filename}", "w") as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user