The abuse report module for golang project.
It is using PostgreSQL as the database and will create a table:
CREATE TABLE IF NOT EXISTS report (
id uuid primary key,
userid integer,
at integer,
handle boolean DEFAULT false,
reason smallint,
value text
);
go get github.com/jackc/pgx
go get github.com/satori/go.uuid
####First need to use the module with the pgx pool passed in:
err := kkreport.Use(pool)
####Insert a report:
err := kkreport.InsertReport(3, 0, "value");
####Get all reports:
reports, err := kkreport.GetAllReports(0);
####Mark one report as handled:
err := kkreport.HandleReport(id);
####Delete a report record:
err := kkreport.DeleteReport(id);
####Get unhandled reports:
reports, err := kkreport.GetUnhandledReports(0);
####Get handled reports:
reports, err := kkreport.GetHandledReports(0);