Documentation
¶
Index ¶
- func SetupPostgresStorage(dns string) error
- type JSONStorage
- func (s *JSONStorage) DeleteSession(ctx context.Context, id string) error
- func (s *JSONStorage) FetchSession(ctx context.Context, id string) (*Session, error)
- func (s *JSONStorage) SaveSession(ctx context.Context, session *Session) error
- func (s *JSONStorage) UpdateSession(ctx context.Context, session *Session) error
- type NoneStorage
- func (s *NoneStorage) DeleteSession(ctx context.Context, id string) error
- func (s *NoneStorage) FetchSession(ctx context.Context, id string) (*Session, error)
- func (s *NoneStorage) SaveSession(ctx context.Context, session *Session) error
- func (s *NoneStorage) UpdateSession(ctx context.Context, session *Session) error
- type PostgresStorage
- func (s *PostgresStorage) DeleteSession(ctx context.Context, id string) error
- func (s *PostgresStorage) FetchSession(ctx context.Context, id string) (*Session, error)
- func (s *PostgresStorage) SaveSession(ctx context.Context, session *Session) error
- func (s *PostgresStorage) UpdateSession(ctx context.Context, session *Session) error
- type Session
- type SessionRow
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupPostgresStorage ¶
Types ¶
type JSONStorage ¶
type JSONStorage struct {
// contains filtered or unexported fields
}
func (*JSONStorage) DeleteSession ¶
func (s *JSONStorage) DeleteSession(ctx context.Context, id string) error
func (*JSONStorage) FetchSession ¶
func (*JSONStorage) SaveSession ¶
func (s *JSONStorage) SaveSession(ctx context.Context, session *Session) error
func (*JSONStorage) UpdateSession ¶
func (s *JSONStorage) UpdateSession(ctx context.Context, session *Session) error
type NoneStorage ¶
type NoneStorage struct {
}
func (*NoneStorage) DeleteSession ¶
func (s *NoneStorage) DeleteSession(ctx context.Context, id string) error
func (*NoneStorage) FetchSession ¶
func (*NoneStorage) SaveSession ¶
func (s *NoneStorage) SaveSession(ctx context.Context, session *Session) error
func (*NoneStorage) UpdateSession ¶
func (s *NoneStorage) UpdateSession(ctx context.Context, session *Session) error
type PostgresStorage ¶
type PostgresStorage struct {
// contains filtered or unexported fields
}
func (*PostgresStorage) DeleteSession ¶
func (s *PostgresStorage) DeleteSession(ctx context.Context, id string) error
func (*PostgresStorage) FetchSession ¶
func (*PostgresStorage) SaveSession ¶
func (s *PostgresStorage) SaveSession(ctx context.Context, session *Session) error
func (*PostgresStorage) UpdateSession ¶
func (s *PostgresStorage) UpdateSession(ctx context.Context, session *Session) error
type Session ¶
type Session struct {
ID string `json:"id" gorm:"column:id;type:bigint(20);AUTO_INCREMENT;primary_key;"` // session id
EngineID string `json:"engine_id" gorm:"column:engine_id;type:varchar(255);"` // engine id
EngineType string `json:"engine_type" gorm:"column:engine_type;type:varchar(255);"` // engine type
EngineData map[string]any `json:"engine_data" gorm:"column:engine_data;type:jsonb"` // engine data
Memory memory.Memory `json:"memory"` // 记忆
CreatedAt time.Time `json:"created_at" gorm:"column:created_at;autoCreateTime"`
UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at;autoUpdateTime"`
}
for domain usage
func NewSession ¶
type SessionRow ¶
type SessionRow struct {
ID string `gorm:"column:id;type:bigint(20);AUTO_INCREMENT;primary_key;"` // session id
EngineID string `gorm:"column:engine_id;type:varchar(255);"` // engine id
EngineType string `gorm:"column:engine_type;type:varchar(255);"` // engine type
EngineData map[string]any `gorm:"column:engine_data;type:jsonb"` // engine data
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime"`
}
For DB row
type Storage ¶
type Storage interface {
SaveSession(ctx context.Context, session *Session) error
FetchSession(ctx context.Context, id string) (*Session, error)
UpdateSession(ctx context.Context, session *Session) error
DeleteSession(ctx context.Context, id string) error
}
func NewJSONStorage ¶
func NewPostgresStorage ¶
Click to show internal directories.
Click to hide internal directories.