store

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: MIT Imports: 10 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity added in v0.14.0

type Activity struct {
	ID int32

	// Standard fields
	CreatorID int32
	CreatedTs int64

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

type DeleteIdentityProvider added in v0.13.2

type DeleteIdentityProvider struct {
	ID int32
}

type DeleteMemo added in v0.14.0

type DeleteMemo struct {
	ID int32
}

type DeleteMemoOrganizer added in v0.14.0

type DeleteMemoOrganizer struct {
	MemoID *int32
	UserID *int32
}

type DeleteMemoRelation added in v0.14.0

type DeleteMemoRelation struct {
	MemoID        *int32
	RelatedMemoID *int32
	Type          *MemoRelationType
}

type DeleteMemoResource added in v0.14.0

type DeleteMemoResource struct {
	MemoID     *int32
	ResourceID *int32
}

type DeleteResource added in v0.14.0

type DeleteResource struct {
	ID int32
}

type DeleteStorage added in v0.14.0

type DeleteStorage struct {
	ID int32
}

type DeleteTag added in v0.14.0

type DeleteTag struct {
	Name      string
	CreatorID int32
}

type DeleteUser added in v0.14.0

type DeleteUser struct {
	ID int32
}

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 *int32
}

type FindMemo added in v0.14.0

type FindMemo struct {
	ID *int32

	// Standard fields
	RowStatus *RowStatus
	CreatorID *int32

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

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

type FindMemoOrganizer added in v0.14.0

type FindMemoOrganizer struct {
	MemoID int32
	UserID int32
}

type FindMemoRelation added in v0.14.0

type FindMemoRelation struct {
	MemoID        *int32
	RelatedMemoID *int32
	Type          *MemoRelationType
}

type FindMemoResource added in v0.14.0

type FindMemoResource struct {
	MemoID     *int32
	ResourceID *int32
}

type FindResource added in v0.14.0

type FindResource struct {
	GetBlob   bool
	ID        *int32
	CreatorID *int32
	Filename  *string
	MemoID    *int32
	Limit     *int
	Offset    *int
}

type FindStorage added in v0.14.0

type FindStorage struct {
	ID *int32
}

type FindSystemSetting added in v0.13.2

type FindSystemSetting struct {
	Name string
}

type FindTag added in v0.14.0

type FindTag struct {
	CreatorID int32
}

type FindUser added in v0.14.0

type FindUser struct {
	ID        *int32
	RowStatus *RowStatus
	Username  *string
	Role      *Role
	Email     *string
	Nickname  *string
	OpenID    *string
}

type FindUserSetting added in v0.13.2

type FindUserSetting struct {
	UserID *int32
	Key    string
}

type IdentityProvider added in v0.13.2

type IdentityProvider struct {
	ID               int32
	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 (
	IdentityProviderOAuth2Type IdentityProviderType = "OAUTH2"
)

func (IdentityProviderType) String added in v0.14.0

func (t IdentityProviderType) String() string

type Memo added in v0.14.0

type Memo struct {
	ID int32

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

	// Domain specific fields
	Content    string
	Visibility Visibility

	// Composed fields
	Pinned         bool
	ResourceIDList []int32
	RelationList   []*MemoRelation
}

type MemoOrganizer added in v0.14.0

type MemoOrganizer struct {
	MemoID int32
	UserID int32
	Pinned bool
}

type MemoRelation added in v0.14.0

type MemoRelation struct {
	MemoID        int32
	RelatedMemoID int32
	Type          MemoRelationType
}

type MemoRelationType added in v0.13.0

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

type MemoResource added in v0.14.0

type MemoResource struct {
	MemoID     int32
	ResourceID int32
	CreatedTs  int64
	UpdatedTs  int64
}

type Resource added in v0.14.0

type Resource struct {
	ID int32

	// Standard fields
	CreatorID int32
	CreatedTs int64
	UpdatedTs int64

	// Domain specific fields
	Filename         string
	Blob             []byte
	InternalPath     string
	ExternalLink     string
	Type             string
	Size             int64
	LinkedMemoAmount int
}

type Role added in v0.13.2

type Role string

Role is the type of a role.

const (
	// RoleHost is the HOST role.
	RoleHost Role = "HOST"
	// RoleAdmin is the ADMIN role.
	RoleAdmin Role = "ADMIN"
	// RoleUser is the USER role.
	RoleUser 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 Storage added in v0.14.0

type Storage struct {
	ID     int32
	Name   string
	Type   string
	Config 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) BackupTo added in v0.14.0

func (s *Store) BackupTo(ctx context.Context, filename string) error

func (*Store) CreateActivity added in v0.10.0

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

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 *Memo) (*Memo, error)

func (*Store) CreateResource

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

func (*Store) CreateStorage added in v0.11.0

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

func (*Store) CreateUser

func (s *Store) CreateUser(ctx context.Context, create *User) (*User, 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 *DeleteMemo) error

func (*Store) DeleteMemoOrganizer added in v0.7.2

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

func (*Store) DeleteMemoRelation added in v0.13.0

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

func (*Store) DeleteMemoResource added in v0.5.0

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

func (*Store) DeleteResource

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

func (*Store) DeleteStorage added in v0.11.0

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

func (*Store) DeleteTag added in v0.9.0

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

func (*Store) DeleteUser added in v0.3.0

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

func (*Store) FindMemosVisibilityList added in v0.13.2

func (s *Store) FindMemosVisibilityList(ctx context.Context, memoIDs []int32) ([]Visibility, 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 *FindMemo) (*Memo, error)

func (*Store) GetMemoOrganizer added in v0.14.0

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

func (*Store) GetMemoRelation added in v0.13.0

func (s *Store) GetMemoRelation(ctx context.Context, find *FindMemoRelation) (*MemoRelation, error)

func (*Store) GetMemoResource added in v0.14.0

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

func (*Store) GetResource added in v0.14.0

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

func (*Store) GetStorage added in v0.14.0

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

func (*Store) GetSystemSetting added in v0.13.2

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

func (*Store) GetSystemSettingValueWithDefault added in v0.14.0

func (s *Store) GetSystemSettingValueWithDefault(ctx *context.Context, settingName string, defaultValue string) string

func (*Store) GetUser added in v0.13.2

func (s *Store) GetUser(ctx context.Context, find *FindUser) (*User, 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 *FindMemoRelation) ([]*MemoRelation, error)

func (*Store) ListMemoResources added in v0.14.0

func (s *Store) ListMemoResources(ctx context.Context, find *FindMemoResource) ([]*MemoResource, error)

func (*Store) ListMemos added in v0.13.1

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

func (*Store) ListResources added in v0.14.0

func (s *Store) ListResources(ctx context.Context, find *FindResource) ([]*Resource, error)

func (*Store) ListStorages added in v0.14.0

func (s *Store) ListStorages(ctx context.Context, find *FindStorage) ([]*Storage, error)

func (*Store) ListSystemSettings added in v0.13.2

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

func (*Store) ListTags added in v0.14.0

func (s *Store) ListTags(ctx context.Context, find *FindTag) ([]*Tag, 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 *FindUser) ([]*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 *UpdateMemo) error

func (*Store) UpdateResource added in v0.14.0

func (s *Store) UpdateResource(ctx context.Context, update *UpdateResource) (*Resource, error)

func (*Store) UpdateStorage added in v0.14.0

func (s *Store) UpdateStorage(ctx context.Context, update *UpdateStorage) (*Storage, error)

func (*Store) UpdateUser added in v0.14.0

func (s *Store) UpdateUser(ctx context.Context, update *UpdateUser) (*User, error)

func (*Store) UpsertMemoOrganizer

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

func (*Store) UpsertMemoRelation added in v0.13.0

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

func (*Store) UpsertMemoResource added in v0.5.0

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

func (*Store) UpsertSystemSetting added in v0.7.1

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

func (*Store) UpsertTag added in v0.9.0

func (s *Store) UpsertTag(ctx context.Context, upsert *Tag) (*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 Tag added in v0.14.0

type Tag struct {
	Name      string
	CreatorID int32
}

type UpdateIdentityProvider added in v0.13.2

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

type UpdateMemo added in v0.14.0

type UpdateMemo struct {
	ID         int32
	CreatedTs  *int64
	UpdatedTs  *int64
	RowStatus  *RowStatus
	Content    *string
	Visibility *Visibility
}

type UpdateResource added in v0.14.0

type UpdateResource struct {
	ID           int32
	UpdatedTs    *int64
	Filename     *string
	InternalPath *string
	Blob         []byte
}

type UpdateStorage added in v0.14.0

type UpdateStorage struct {
	ID     int32
	Name   *string
	Config *string
}

type UpdateUser added in v0.14.0

type UpdateUser struct {
	ID int32

	UpdatedTs    *int64
	RowStatus    *RowStatus
	Username     *string `json:"username"`
	Email        *string `json:"email"`
	Nickname     *string `json:"nickname"`
	Password     *string `json:"password"`
	ResetOpenID  *bool   `json:"resetOpenId"`
	AvatarURL    *string `json:"avatarUrl"`
	PasswordHash *string
	OpenID       *string
}

type UpsertMemoResource added in v0.14.0

type UpsertMemoResource struct {
	MemoID     int32
	ResourceID int32
	CreatedTs  int64
	UpdatedTs  *int64
}

type User added in v0.14.0

type User struct {
	ID int32

	// 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 int32
	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