db

package
v0.0.0-...-8142f9b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2020 License: MIT Imports: 5 Imported by: 0

README

DB Creation SQL

-- Image table.
CREATE TABLE "images" (
  "id"                    BIGSERIAL,
  "telegram_user_id"      BIGINT       NOT NULL, -- ID for the user sending the image, for validating image deleting callbacks
  "telegram_reply_msg_id" BIGINT       NOT NULL, -- ID for the replying message with the image URL, for updating the reply
  "imgur_url"             VARCHAR(100) NOT NULL, -- URL of the image uploaded to Imgur
  "imgur_delete_hash"     VARCHAR(20)  NOT NULL, -- Hash for deleting the image from Imgur
  "create_time_utc"       TIMESTAMP    NOT NULL DEFAULT current_timestamp,
  PRIMARY KEY (id)
);

CREATE UNIQUE INDEX uniq_idx_images_telegram_reply_msg_id ON images ("telegram_reply_msg_id") WHERE "telegram_reply_msg_id" != 0;
CREATE UNIQUE INDEX uniq_idx_images_imgur_url ON images ("imgur_url");
CREATE UNIQUE INDEX uniq_idx_images_imgur_delete_hash ON images ("imgur_delete_hash");

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Image = new(image)

Image is the entry point for image DB APIs.

Functions

func Init

func Init(dsn string) error

Init initializes database connection.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL