mysql

package
v0.0.0-...-6b983b4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLStore

type MySQLStore struct {
	DB *gorm.DB
}

func NewMySQLStore

func NewMySQLStore(user, password, host string, port int, dbName string) (*MySQLStore, error)

NewMySQLStore는 MySQL 연결을 설정하고, 필요한 경우 데이터베이스를 생성합니다.

func (*MySQLStore) AddSubscriber

func (m *MySQLStore) AddSubscriber(subscriber Subscriber) error

/ AddSubscriber는 새로운 구독자를 데이터베이스에 추가합니다.

func (*MySQLStore) DeleteSubscriber

func (m *MySQLStore) DeleteSubscriber(token string, topic string, platform int) error

DeleteSubscriber는 주어진 토큰, 토픽 및 플랫폼을 기준으로 구독자를 삭제합니다.

func (*MySQLStore) GetAllSubscribers

func (m *MySQLStore) GetAllSubscribers() ([]Subscriber, error)

GetAllSubscribers는 모든 구독자를 반환합니다.

func (*MySQLStore) GetSubscriberByToken

func (m *MySQLStore) GetSubscriberByToken(token string) (*Subscriber, error)

GetSubscriberByToken은 특정 디바이스 토큰으로 구독자를 조회합니다.

func (*MySQLStore) GetSubscribersByTopic

func (m *MySQLStore) GetSubscribersByTopic(topic string) ([]Subscriber, error)

GetSubscribersByTopic은 특정 토픽을 구독한 구독자들을 조회합니다.

type Subscriber

type Subscriber struct {
	gorm.Model
	Token    string `json:"token" gorm:"type:varchar(255);uniqueIndex"` // 디바이스 토큰 (고유 인덱스)
	Platform int    `json:"platform" gorm:"type:int"`                   // 플랫폼 정보 (예: 1 = iOS, 2 = Android)
	Topic    string `json:"topic" gorm:"type:varchar(255)"`             // 구독할 주제
}

Subscriber는 구독자 스키마를 정의하는 구조체입니다.

Jump to

Keyboard shortcuts

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