From f2e811bf2b9a1560e091cc3f8d1ab1cafa6a3738 Mon Sep 17 00:00:00 2001 From: Michael Li Date: Thu, 20 Apr 2023 18:00:05 +0800 Subject: [PATCH] sqlc: fixed miss method error --- .../schema/0005_topic_follow.down.sql | 1 + .../postgres/schema/0005_topic_follow.up.sql | 16 ++++++++++ internal/dao/slonik/topics.go | 31 +++++++++++++++++++ .../postgres/0005_topic_follow.down.sql | 2 +- 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 internal/dao/slonik/sqlc/postgres/schema/0005_topic_follow.down.sql create mode 100644 internal/dao/slonik/sqlc/postgres/schema/0005_topic_follow.up.sql diff --git a/internal/dao/slonik/sqlc/postgres/schema/0005_topic_follow.down.sql b/internal/dao/slonik/sqlc/postgres/schema/0005_topic_follow.down.sql new file mode 100644 index 00000000..fe5b9746 --- /dev/null +++ b/internal/dao/slonik/sqlc/postgres/schema/0005_topic_follow.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS p_topic_user; \ No newline at end of file diff --git a/internal/dao/slonik/sqlc/postgres/schema/0005_topic_follow.up.sql b/internal/dao/slonik/sqlc/postgres/schema/0005_topic_follow.up.sql new file mode 100644 index 00000000..5398a4c8 --- /dev/null +++ b/internal/dao/slonik/sqlc/postgres/schema/0005_topic_follow.up.sql @@ -0,0 +1,16 @@ +CREATE TABLE p_topic_user ( + ID BIGSERIAL PRIMARY KEY, + topic_id BIGINT NOT NULL,-- 标签ID + user_id BIGINT NOT NULL,-- 创建者ID + alias_name VARCHAR ( 255 ),-- 别名 + remark VARCHAR ( 512 ),-- 备注 + quote_num BIGINT,-- 引用数 + is_top SMALLINT NOT NULL DEFAULT 0,-- 是否置顶 0 为未置顶、1 为已置顶 + created_on BIGINT NOT NULL DEFAULT 0,-- 创建时间 + modified_on BIGINT NOT NULL DEFAULT 0,-- 修改时间 + deleted_on BIGINT NOT NULL DEFAULT 0,-- 删除时间 + is_del SMALLINT NOT NULL DEFAULT 0,-- 是否删除 0 为未删除、1 为已删除 + reserve_a VARCHAR ( 255 ),-- 保留字段a + reserve_b VARCHAR ( 255 ) -- 保留字段b +); +CREATE UNIQUE INDEX idx_topic_user_uid_tid ON p_topic_user USING btree ( topic_id, user_id ); \ No newline at end of file diff --git a/internal/dao/slonik/topics.go b/internal/dao/slonik/topics.go index b38ade46..9d2eaf7a 100644 --- a/internal/dao/slonik/topics.go +++ b/internal/dao/slonik/topics.go @@ -13,6 +13,7 @@ import ( "github.com/rocboss/paopao-ce/internal/core" "github.com/rocboss/paopao-ce/internal/core/cs" dbr "github.com/rocboss/paopao-ce/internal/dao/slonik/sqlc/postgres" + "github.com/rocboss/paopao-ce/pkg/debug" ) var ( @@ -163,6 +164,36 @@ func (s *topicSrv) TagsByKeyword(keyword string) (res cs.TagInfoList, _ error) { return } +func (s *topicSrv) GetHotTags(userId int64, limit int, offset int) (cs.TagList, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *topicSrv) GetNewestTags(userId int64, limit int, offset int) (cs.TagList, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *topicSrv) GetFollowTags(userId int64, limit int, offset int) (cs.TagList, error) { + // TODO + return nil, debug.ErrNotImplemented +} + +func (s *topicSrv) FollowTopic(userId int64, topicId int64) error { + // TODO + return debug.ErrNotImplemented +} + +func (s *topicSrv) UnfollowTopic(userId int64, topicId int64) error { + // TODO + return debug.ErrNotImplemented +} + +func (s *topicSrv) StickTopic(userId int64, topicId int64) (int8, error) { + // TODO + return 0, debug.ErrNotImplemented +} + func newTopicService(db *pgx.Conn) core.TopicService { return &topicSrv{ pgxSrv: newPgxSrv(db), diff --git a/scripts/migration/postgres/0005_topic_follow.down.sql b/scripts/migration/postgres/0005_topic_follow.down.sql index d826f2fb..fe5b9746 100644 --- a/scripts/migration/postgres/0005_topic_follow.down.sql +++ b/scripts/migration/postgres/0005_topic_follow.down.sql @@ -1 +1 @@ -DROP TABLE IF EXISTS `p_topic_user`; \ No newline at end of file +DROP TABLE IF EXISTS p_topic_user; \ No newline at end of file