store

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: MIT Imports: 12 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatError

func FormatError(err error) error

Types

type ActivityMessage added in v0.13.2

type ActivityMessage struct {
	ID int

	// Standard fields
	CreatorID int
	CreatedTs int64

	// Domain specific fields
	Type    string
	Level   string
	Payload string
}

type DeleteIdentityProvider added in v0.13.2

type DeleteIdentityProvider struct {
	ID int
}

type DeleteMemoMessage added in v0.13.1

type DeleteMemoMessage struct {
	ID int
}

type DeleteMemoRelationMessage added in v0.13.0

type DeleteMemoRelationMessage struct {
	MemoID        *int
	RelatedMemoID *int
	Type          *MemoRelationType
}

type FieldMapping added in v0.11.0

type FieldMapping struct {
	Identifier  string `json:"identifier"`
	DisplayName string `json:"displayName"`
	Email       string `json:"email"`
}

type FindIdentityProvider added in v0.13.2

type FindIdentityProvider struct {
	ID *int
}

type FindMemoMessage added in v0.13.1

type FindMemoMessage struct {
	ID *int

	// Standard fields
	RowStatus *RowStatus
	CreatorID *int

	// Domain specific fields
	Pinned         *bool
	ContentSearch  []string
	VisibilityList []Visibility

	// Pagination
	Limit            *int
	Offset           *int
	OrderByUpdatedTs bool
}

type FindMemoRelationMessage added in v0.13.0

type FindMemoRelationMessage struct {
	MemoID        *int
	RelatedMemoID *int
	Type          *MemoRelationType
}

type FindSystemSetting added in v0.13.2

type FindSystemSetting struct {
	Name string
}

type FindUserMessage added in v0.13.2

type FindUserMessage struct {
	ID *int

	// Standard fields
	RowStatus *RowStatus

	// Domain specific fields
	Username *string
	Role     *Role
	Email    *string
	Nickname *string
	OpenID   *string
}

type FindUserSetting added in v0.13.2

type FindUserSetting struct {
	UserID *int
	Key    string
}

type IdentityProvider added in v0.13.2

type IdentityProvider struct {
	ID               int
	Name             string
	Type             IdentityProviderType
	IdentifierFilter string
	Config           *IdentityProviderConfig
}

type IdentityProviderConfig added in v0.11.0

type IdentityProviderConfig struct {
	OAuth2Config *IdentityProviderOAuth2Config
}

type IdentityProviderOAuth2Config added in v0.11.0

type IdentityProviderOAuth2Config struct {
	ClientID     string        `json:"clientId"`
	ClientSecret string        `json:"clientSecret"`
	AuthURL      string        `json:"authUrl"`
	TokenURL     string        `json:"tokenUrl"`
	UserInfoURL  string        `json:"userInfoUrl"`
	Scopes       []string      `json:"scopes"`
	FieldMapping *FieldMapping `json:"fieldMapping"`
}

type IdentityProviderType added in v0.11.0

type IdentityProviderType string
const (
	IdentityProviderOAuth2 IdentityProviderType = "OAUTH2"
)

type MemoMessage added in v0.13.1

type MemoMessage struct {
	ID int

	// Standard fields
	RowStatus RowStatus
	CreatorID int
	CreatedTs int64
	UpdatedTs int64

	// Domain specific fields
	Content    string
	Visibility Visibility

	// Composed fields
	Pinned         bool
	ResourceIDList []int
	RelationList   []*MemoRelationMessage
}

type MemoRelationMessage added in v0.13.0

type MemoRelationMessage struct {
	MemoID        int
	RelatedMemoID int
	Type          MemoRelationType
}

type MemoRelationType added in v0.13.0

type MemoRelationType string
const (
	MemoRelationReference  MemoRelationType = "REFERENCE"
	MemoRelationAdditional MemoRelationType = "ADDITIONAL"
)

type Role added in v0.13.2

type Role string

Role is the type of a role.

const (
	// Host is the HOST role.
	Host Role = "HOST"
	// Admin is the ADMIN role.
	Admin Role = "ADMIN"
	// NormalUser is the USER role.
	NormalUser Role = "USER"
)

func (Role) String added in v0.13.2

func (e Role) String() string

type RowStatus added in v0.13.1

type RowStatus string

RowStatus is the status for a row.

const (
	// Normal is the status for a normal row.
	Normal RowStatus = "NORMAL"
	// Archived is the status for an archived row.
	Archived RowStatus = "ARCHIVED"
)

func (RowStatus) String added in v0.13.1

func (r RowStatus) String() string

type Store

type Store struct {
	Profile *profile.Profile
	// contains filtered or unexported fields
}

Store provides database access to all raw objects.

func New

func New(db *sql.DB, profile *profile.Profile) *Store

New creates a new instance of Store.

func (*Store) CreateActivity added in v0.10.0

func (s *Store) CreateActivity(ctx context.Context, create *api.ActivityCreate) (*api.Activity, error)

CreateActivity creates an instance of Activity.

func (*Store) CreateActivityV1 added in v0.13.2

func (s *Store) CreateActivityV1(ctx context.Context, create *ActivityMessage) (*ActivityMessage, error)

CreateActivityV1 creates an instance of Activity.

func (*Store) CreateIdentityProvider added in v0.11.0

func (s *Store) CreateIdentityProvider(ctx context.Context, create *IdentityProvider) (*IdentityProvider, error)

func (*Store) CreateMemo

func (s *Store) CreateMemo(ctx context.Context, create *MemoMessage) (*MemoMessage, error)

func (*Store) CreateResource

func (s *Store) CreateResource(ctx context.Context, create *api.ResourceCreate) (*api.Resource, error)

func (*Store) CreateShortcut

func (s *Store) CreateShortcut(ctx context.Context, create *api.ShortcutCreate) (*api.Shortcut, error)

func (*Store) CreateStorage added in v0.11.0

func (s *Store) CreateStorage(ctx context.Context, create *api.StorageCreate) (*api.Storage, error)

func (*Store) CreateUser

func (s *Store) CreateUser(ctx context.Context, create *api.UserCreate) (*api.User, error)

func (*Store) CreateUserV1 added in v0.13.2

func (s *Store) CreateUserV1(ctx context.Context, create *UserMessage) (*UserMessage, error)

func (*Store) DeleteIdentityProvider added in v0.11.0

func (s *Store) DeleteIdentityProvider(ctx context.Context, delete *DeleteIdentityProvider) error

func (*Store) DeleteMemo

func (s *Store) DeleteMemo(ctx context.Context, delete *DeleteMemoMessage) error

func (*Store) DeleteMemoOrganizer added in v0.7.2

func (s *Store) DeleteMemoOrganizer(ctx context.Context, delete *api.MemoOrganizerDelete) error

func (*Store) DeleteMemoRelation added in v0.13.0

func (s *Store) DeleteMemoRelation(ctx context.Context, delete *DeleteMemoRelationMessage) error

func (*Store) DeleteMemoResource added in v0.5.0

func (s *Store) DeleteMemoResource(ctx context.Context, delete *api.MemoResourceDelete) error

func (*Store) DeleteResource

func (s *Store) DeleteResource(ctx context.Context, delete *api.ResourceDelete) error

func (*Store) DeleteShortcut

func (s *Store) DeleteShortcut(ctx context.Context, delete *api.ShortcutDelete) error

func (*Store) DeleteStorage added in v0.11.0

func (s *Store) DeleteStorage(ctx context.Context, delete *api.StorageDelete) error

func (*Store) DeleteTag added in v0.9.0

func (s *Store) DeleteTag(ctx context.Context, delete *api.TagDelete) error

func (*Store) DeleteUser added in v0.3.0

func (s *Store) DeleteUser(ctx context.Context, delete *api.UserDelete) error

func (*Store) FindMemoOrganizer

func (s *Store) FindMemoOrganizer(ctx context.Context, find *api.MemoOrganizerFind) (*api.MemoOrganizer, error)

func (*Store) FindMemoResource added in v0.6.0

func (s *Store) FindMemoResource(ctx context.Context, find *api.MemoResourceFind) (*api.MemoResource, error)

func (*Store) FindMemoResourceList added in v0.5.0

func (s *Store) FindMemoResourceList(ctx context.Context, find *api.MemoResourceFind) ([]*api.MemoResource, error)

func (*Store) FindMemosVisibilityList added in v0.13.2

func (s *Store) FindMemosVisibilityList(ctx context.Context, memoIDs []int) ([]Visibility, error)

func (*Store) FindResource

func (s *Store) FindResource(ctx context.Context, find *api.ResourceFind) (*api.Resource, error)

func (*Store) FindResourceList

func (s *Store) FindResourceList(ctx context.Context, find *api.ResourceFind) ([]*api.Resource, error)

func (*Store) FindShortcut

func (s *Store) FindShortcut(ctx context.Context, find *api.ShortcutFind) (*api.Shortcut, error)

func (*Store) FindShortcutList

func (s *Store) FindShortcutList(ctx context.Context, find *api.ShortcutFind) ([]*api.Shortcut, error)

func (*Store) FindStorage added in v0.11.0

func (s *Store) FindStorage(ctx context.Context, find *api.StorageFind) (*api.Storage, error)

func (*Store) FindStorageList added in v0.11.0

func (s *Store) FindStorageList(ctx context.Context, find *api.StorageFind) ([]*api.Storage, error)

func (*Store) FindSystemSetting added in v0.7.1

func (s *Store) FindSystemSetting(ctx context.Context, find *api.SystemSettingFind) (*api.SystemSetting, error)

func (*Store) FindSystemSettingList added in v0.7.1

func (s *Store) FindSystemSettingList(ctx context.Context, find *api.SystemSettingFind) ([]*api.SystemSetting, error)

func (*Store) FindTagList added in v0.9.0

func (s *Store) FindTagList(ctx context.Context, find *api.TagFind) ([]*api.Tag, error)

func (*Store) FindUser

func (s *Store) FindUser(ctx context.Context, find *api.UserFind) (*api.User, error)

func (*Store) FindUserList

func (s *Store) FindUserList(ctx context.Context, find *api.UserFind) ([]*api.User, error)

func (*Store) GetDB added in v0.13.2

func (s *Store) GetDB() *sql.DB

func (*Store) GetIdentityProvider added in v0.11.0

func (s *Store) GetIdentityProvider(ctx context.Context, find *FindIdentityProvider) (*IdentityProvider, error)

func (*Store) GetMemo added in v0.13.1

func (s *Store) GetMemo(ctx context.Context, find *FindMemoMessage) (*MemoMessage, error)

func (*Store) GetMemoRelation added in v0.13.0

func (s *Store) GetMemoRelation(ctx context.Context, find *FindMemoRelationMessage) (*MemoRelationMessage, error)

func (*Store) GetSystemSetting added in v0.13.2

func (s *Store) GetSystemSetting(ctx context.Context, find *FindSystemSetting) (*SystemSetting, error)

func (*Store) GetSystemSettingValueOrDefault added in v0.13.0

func (s *Store) GetSystemSettingValueOrDefault(ctx *context.Context, find api.SystemSettingName, defaultValue string) string

func (*Store) GetUser added in v0.13.2

func (s *Store) GetUser(ctx context.Context, find *FindUserMessage) (*UserMessage, error)

func (*Store) GetUserSetting added in v0.13.2

func (s *Store) GetUserSetting(ctx context.Context, find *FindUserSetting) (*UserSetting, error)

func (*Store) ListIdentityProviders added in v0.11.0

func (s *Store) ListIdentityProviders(ctx context.Context, find *FindIdentityProvider) ([]*IdentityProvider, error)

func (*Store) ListMemoRelations added in v0.13.0

func (s *Store) ListMemoRelations(ctx context.Context, find *FindMemoRelationMessage) ([]*MemoRelationMessage, error)

func (*Store) ListMemos added in v0.13.1

func (s *Store) ListMemos(ctx context.Context, find *FindMemoMessage) ([]*MemoMessage, error)

func (*Store) ListSystemSettings added in v0.13.2

func (s *Store) ListSystemSettings(ctx context.Context, find *FindSystemSetting) ([]*SystemSetting, error)

func (*Store) ListUserSettings added in v0.13.2

func (s *Store) ListUserSettings(ctx context.Context, find *FindUserSetting) ([]*UserSetting, error)

func (*Store) ListUsers added in v0.13.2

func (s *Store) ListUsers(ctx context.Context, find *FindUserMessage) ([]*UserMessage, error)

func (*Store) PatchResource added in v0.7.0

func (s *Store) PatchResource(ctx context.Context, patch *api.ResourcePatch) (*api.Resource, error)

func (*Store) PatchShortcut

func (s *Store) PatchShortcut(ctx context.Context, patch *api.ShortcutPatch) (*api.Shortcut, error)

func (*Store) PatchStorage added in v0.11.0

func (s *Store) PatchStorage(ctx context.Context, patch *api.StoragePatch) (*api.Storage, error)

func (*Store) PatchUser

func (s *Store) PatchUser(ctx context.Context, patch *api.UserPatch) (*api.User, error)

func (*Store) UpdateIdentityProvider added in v0.11.0

func (s *Store) UpdateIdentityProvider(ctx context.Context, update *UpdateIdentityProvider) (*IdentityProvider, error)

func (*Store) UpdateMemo added in v0.13.1

func (s *Store) UpdateMemo(ctx context.Context, update *UpdateMemoMessage) error

func (*Store) UpsertMemoOrganizer

func (s *Store) UpsertMemoOrganizer(ctx context.Context, upsert *api.MemoOrganizerUpsert) error

func (*Store) UpsertMemoRelation added in v0.13.0

func (s *Store) UpsertMemoRelation(ctx context.Context, create *MemoRelationMessage) (*MemoRelationMessage, error)

func (*Store) UpsertMemoResource added in v0.5.0

func (s *Store) UpsertMemoResource(ctx context.Context, upsert *api.MemoResourceUpsert) (*api.MemoResource, error)

func (*Store) UpsertSystemSetting added in v0.7.1

func (s *Store) UpsertSystemSetting(ctx context.Context, upsert *api.SystemSettingUpsert) (*api.SystemSetting, error)

func (*Store) UpsertTag added in v0.9.0

func (s *Store) UpsertTag(ctx context.Context, upsert *api.TagUpsert) (*api.Tag, error)

func (*Store) UpsertUserSetting added in v0.4.0

func (s *Store) UpsertUserSetting(ctx context.Context, upsert *UserSetting) (*UserSetting, error)

func (*Store) Vacuum added in v0.7.2

func (s *Store) Vacuum(ctx context.Context) error

type SystemSetting added in v0.13.2

type SystemSetting struct {
	Name        string
	Value       string
	Description string
}

type UpdateIdentityProvider added in v0.13.2

type UpdateIdentityProvider struct {
	ID               int
	Type             IdentityProviderType
	Name             *string
	IdentifierFilter *string
	Config           *IdentityProviderConfig
}

type UpdateMemoMessage added in v0.13.1

type UpdateMemoMessage struct {
	ID         int
	CreatedTs  *int64
	UpdatedTs  *int64
	RowStatus  *RowStatus
	Content    *string
	Visibility *Visibility
}

type UserMessage added in v0.13.2

type UserMessage struct {
	ID int

	// Standard fields
	RowStatus RowStatus
	CreatedTs int64
	UpdatedTs int64

	// Domain specific fields
	Username     string
	Role         Role
	Email        string
	Nickname     string
	PasswordHash string
	OpenID       string
	AvatarURL    string
}

type UserSetting added in v0.13.2

type UserSetting struct {
	UserID int
	Key    string
	Value  string
}

type Visibility added in v0.13.1

type Visibility string

Visibility is the type of a visibility.

const (
	// Public is the PUBLIC visibility.
	Public Visibility = "PUBLIC"
	// Protected is the PROTECTED visibility.
	Protected Visibility = "PROTECTED"
	// Private is the PRIVATE visibility.
	Private Visibility = "PRIVATE"
)

func (Visibility) String added in v0.13.1

func (v Visibility) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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