This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"os" | |
"sync" | |
"github.com/google/go-github/v53/github" | |
"golang.org/x/exp/slog" | |
"golang.org/x/oauth2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"sync" | |
"testing" | |
"golang.org/x/exp/slog" | |
) | |
func TestMain(m *testing.M) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"html/template" | |
"log" | |
"net/http" | |
"sync" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package shortener | |
import ( | |
"bytes" | |
"fmt" | |
"github.com/bwmarrin/snowflake" | |
) | |
const ( | |
base62Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package shortener | |
import ( | |
"sync" | |
"testing" | |
) | |
func TestShorten(t *testing.T) { | |
var ids []Response |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"net/http" | |
"net/http/httptest" | |
"strings" | |
"testing" | |
"url-shortener/shortener" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>URL Shortener</title> | |
<script src="https://cdn.tailwindcss.com"></script> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.9" | |
services: | |
postgres: | |
image: postgres:14-alpine | |
environment: | |
- POSTGRES_USER=root | |
- POSTGRES_PASSWORD=secret | |
- POSTGRES_DB=fts | |
ports: | |
- "5432:5432" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; | |
CREATE TABLE instructors | |
( | |
id UUID PRIMARY KEY, | |
name VARCHAR NOT NULL, | |
occupation VARCHAR NOT NULL, | |
email VARCHAR NOT NULL, | |
name_tsvector TSVECTOR GENERATED ALWAYS AS (TO_TSVECTOR('indonesian', name)) STORED, | |
occupation_tsvector TSVECTOR GENERATED ALWAYS AS (TO_TSVECTOR('indonesian', occupation)) STORED, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"errors" | |
"fmt" | |
"github.com/google/uuid" | |
"github.com/jackc/pgx/v5" | |
"net/mail" | |
"strings" |
OlderNewer