mattermost-community-enterp.../public/pluginapi/experimental/panel/store.go
Claude ec1f89217a Merge: Complete Mattermost Server with Community Enterprise
Full Mattermost server source with integrated Community Enterprise features.
Includes vendor directory for offline/air-gapped builds.

Structure:
- enterprise-impl/: Enterprise feature implementations
- enterprise-community/: Init files that register implementations
- enterprise/: Bridge imports (community_imports.go)
- vendor/: All dependencies for offline builds

Build (online):
  go build ./cmd/mattermost

Build (offline/air-gapped):
  go build -mod=vendor ./cmd/mattermost

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 23:59:07 +09:00

54 lines
1.1 KiB
Go

package panel
import (
"errors"
"github.com/mattermost/mattermost/server/public/pluginapi"
)
type Store interface {
SetPanelPostID(userID string, postID string) error
GetPanelPostID(userID string) (string, error)
DeletePanelPostID(userID string) error
}
type panelStore struct {
kv *pluginapi.KVService
keyPrefix string
}
func NewPanelStore(kv *pluginapi.KVService, keyPrefix string) Store {
return &panelStore{
kv: kv,
keyPrefix: keyPrefix,
}
}
func (ps *panelStore) SetPanelPostID(userID, postID string) error {
ok, err := ps.kv.Set(ps.getKey(userID), postID)
if err != nil {
return err
}
if !ok {
return errors.New("value not set without errors")
}
return nil
}
func (ps *panelStore) GetPanelPostID(userID string) (string, error) {
var postID string
err := ps.kv.Get(ps.getKey(userID), &postID)
if err != nil {
return "", err
}
return postID, nil
}
func (ps *panelStore) DeletePanelPostID(userID string) error {
return ps.kv.Delete(ps.getKey(userID))
}
func (ps *panelStore) getKey(userID string) string {
return ps.keyPrefix + "-" + userID
}