model

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: (devel)

Code generated by volcago. DO NOT EDIT. generated version: (devel)

Code generated by volcago. DO NOT EDIT. generated version: (devel)

Code generated by volcago. DO NOT EDIT. generated version: (devel)

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Code generated by volcago. DO NOT EDIT. generated version: devel

Index

Constants

View Source
const (
	LockIndexLabelTextEqual       = "t4" // perfect-match of Text
	LockIndexLabelTextLike        = "t3" // like-match of Text
	LockIndexLabelTextPrefix      = "t1" // prefix-match of Text
	LockIndexLabelTextSuffix      = "t2" // suffix-match of Text
	LockIndexLabelFlagPrefix      = "f1" // prefix-match of Flag
	LockIndexLabelFlagSuffix      = "f2" // suffix-match of Flag
	LockIndexLabelFlagLike        = "f3" // like-match of Flag
	LockIndexLabelFlagEqual       = "f4" // perfect-match of Flag
	LockIndexLabelCreatedAtPrefix = "c1" // prefix-match of CreatedAt
	LockIndexLabelCreatedAtSuffix = "c2" // suffix-match of CreatedAt
	LockIndexLabelCreatedAtLike   = "c3" // like-match of CreatedAt
	LockIndexLabelCreatedAtEqual  = "c4" // perfect-match of CreatedAt
	LockIndexLabelCreatedByEqual  = "c8" // perfect-match of CreatedBy
	LockIndexLabelCreatedByLike   = "c7" // like-match of CreatedBy
	LockIndexLabelCreatedByPrefix = "c5" // prefix-match of CreatedBy
	LockIndexLabelCreatedBySuffix = "c6" // suffix-match of CreatedBy
	LockIndexLabelUpdatedAtPrefix = "u1" // prefix-match of UpdatedAt
	LockIndexLabelUpdatedAtSuffix = "u2" // suffix-match of UpdatedAt
	LockIndexLabelUpdatedAtLike   = "u3" // like-match of UpdatedAt
	LockIndexLabelUpdatedAtEqual  = "u4" // perfect-match of UpdatedAt
	LockIndexLabelUpdatedByEqual  = "u8" // perfect-match of UpdatedBy
	LockIndexLabelUpdatedByLike   = "u7" // like-match of UpdatedBy
	LockIndexLabelUpdatedByPrefix = "u5" // prefix-match of UpdatedBy
	LockIndexLabelUpdatedBySuffix = "u6" // suffix-match of UpdatedBy
	LockIndexLabelDeletedAtPrefix = "d1" // prefix-match of DeletedAt
	LockIndexLabelDeletedAtSuffix = "d2" // suffix-match of DeletedAt
	LockIndexLabelDeletedAtLike   = "d3" // like-match of DeletedAt
	LockIndexLabelDeletedAtEqual  = "d4" // perfect-match of DeletedAt
	LockIndexLabelDeletedByEqual  = "d8" // perfect-match of DeletedBy
	LockIndexLabelDeletedByLike   = "d7" // like-match of DeletedBy
	LockIndexLabelDeletedByPrefix = "d5" // prefix-match of DeletedBy
	LockIndexLabelDeletedBySuffix = "d6" // suffix-match of DeletedBy
	LockIndexLabelVersionPrefix   = "v1" // prefix-match of Version
	LockIndexLabelVersionSuffix   = "v2" // suffix-match of Version
	LockIndexLabelVersionLike     = "v3" // like-match of Version
	LockIndexLabelVersionEqual    = "v4" // perfect-match of Version
)
View Source
const (
	LockMeta2IndexLabelTextEqual       = "t4" // perfect-match of Text
	LockMeta2IndexLabelTextLike        = "t3" // like-match of Text
	LockMeta2IndexLabelTextPrefix      = "t1" // prefix-match of Text
	LockMeta2IndexLabelTextSuffix      = "t2" // suffix-match of Text
	LockMeta2IndexLabelFlagPrefix      = "f1" // prefix-match of Flag
	LockMeta2IndexLabelFlagSuffix      = "f2" // suffix-match of Flag
	LockMeta2IndexLabelFlagLike        = "f3" // like-match of Flag
	LockMeta2IndexLabelFlagEqual       = "f4" // perfect-match of Flag
	LockMeta2IndexLabelCreatedAtPrefix = "c1" // prefix-match of CreatedAt
	LockMeta2IndexLabelCreatedAtSuffix = "c2" // suffix-match of CreatedAt
	LockMeta2IndexLabelCreatedAtLike   = "c3" // like-match of CreatedAt
	LockMeta2IndexLabelCreatedAtEqual  = "c4" // perfect-match of CreatedAt
	LockMeta2IndexLabelCreatedByEqual  = "c8" // perfect-match of CreatedBy
	LockMeta2IndexLabelCreatedByLike   = "c7" // like-match of CreatedBy
	LockMeta2IndexLabelCreatedByPrefix = "c5" // prefix-match of CreatedBy
	LockMeta2IndexLabelCreatedBySuffix = "c6" // suffix-match of CreatedBy
	LockMeta2IndexLabelUpdatedAtPrefix = "u1" // prefix-match of UpdatedAt
	LockMeta2IndexLabelUpdatedAtSuffix = "u2" // suffix-match of UpdatedAt
	LockMeta2IndexLabelUpdatedAtLike   = "u3" // like-match of UpdatedAt
	LockMeta2IndexLabelUpdatedAtEqual  = "u4" // perfect-match of UpdatedAt
	LockMeta2IndexLabelUpdatedByEqual  = "u8" // perfect-match of UpdatedBy
	LockMeta2IndexLabelUpdatedByLike   = "u7" // like-match of UpdatedBy
	LockMeta2IndexLabelUpdatedByPrefix = "u5" // prefix-match of UpdatedBy
	LockMeta2IndexLabelUpdatedBySuffix = "u6" // suffix-match of UpdatedBy
	LockMeta2IndexLabelDeletedAtPrefix = "d1" // prefix-match of DeletedAt
	LockMeta2IndexLabelDeletedAtSuffix = "d2" // suffix-match of DeletedAt
	LockMeta2IndexLabelDeletedAtLike   = "d3" // like-match of DeletedAt
	LockMeta2IndexLabelDeletedAtEqual  = "d4" // perfect-match of DeletedAt
	LockMeta2IndexLabelDeletedByEqual  = "d8" // perfect-match of DeletedBy
	LockMeta2IndexLabelDeletedByLike   = "d7" // like-match of DeletedBy
	LockMeta2IndexLabelDeletedByPrefix = "d5" // prefix-match of DeletedBy
	LockMeta2IndexLabelDeletedBySuffix = "d6" // suffix-match of DeletedBy
	LockMeta2IndexLabelVersionPrefix   = "v1" // prefix-match of Version
	LockMeta2IndexLabelVersionSuffix   = "v2" // suffix-match of Version
	LockMeta2IndexLabelVersionLike     = "v3" // like-match of Version
	LockMeta2IndexLabelVersionEqual    = "v4" // perfect-match of Version
)
View Source
const (
	LockMetaIndexLabelTextEqual       = "t4" // perfect-match of Text
	LockMetaIndexLabelTextLike        = "t3" // like-match of Text
	LockMetaIndexLabelTextPrefix      = "t1" // prefix-match of Text
	LockMetaIndexLabelTextSuffix      = "t2" // suffix-match of Text
	LockMetaIndexLabelFlagPrefix      = "f1" // prefix-match of Flag
	LockMetaIndexLabelFlagSuffix      = "f2" // suffix-match of Flag
	LockMetaIndexLabelFlagLike        = "f3" // like-match of Flag
	LockMetaIndexLabelFlagEqual       = "f4" // perfect-match of Flag
	LockMetaIndexLabelCreatedAtPrefix = "c1" // prefix-match of CreatedAt
	LockMetaIndexLabelCreatedAtSuffix = "c2" // suffix-match of CreatedAt
	LockMetaIndexLabelCreatedAtLike   = "c3" // like-match of CreatedAt
	LockMetaIndexLabelCreatedAtEqual  = "c4" // perfect-match of CreatedAt
	LockMetaIndexLabelCreatedByEqual  = "c8" // perfect-match of CreatedBy
	LockMetaIndexLabelCreatedByLike   = "c7" // like-match of CreatedBy
	LockMetaIndexLabelCreatedByPrefix = "c5" // prefix-match of CreatedBy
	LockMetaIndexLabelCreatedBySuffix = "c6" // suffix-match of CreatedBy
	LockMetaIndexLabelUpdatedAtPrefix = "u1" // prefix-match of UpdatedAt
	LockMetaIndexLabelUpdatedAtSuffix = "u2" // suffix-match of UpdatedAt
	LockMetaIndexLabelUpdatedAtLike   = "u3" // like-match of UpdatedAt
	LockMetaIndexLabelUpdatedAtEqual  = "u4" // perfect-match of UpdatedAt
	LockMetaIndexLabelUpdatedByEqual  = "u8" // perfect-match of UpdatedBy
	LockMetaIndexLabelUpdatedByLike   = "u7" // like-match of UpdatedBy
	LockMetaIndexLabelUpdatedByPrefix = "u5" // prefix-match of UpdatedBy
	LockMetaIndexLabelUpdatedBySuffix = "u6" // suffix-match of UpdatedBy
	LockMetaIndexLabelDeletedAtPrefix = "d1" // prefix-match of DeletedAt
	LockMetaIndexLabelDeletedAtSuffix = "d2" // suffix-match of DeletedAt
	LockMetaIndexLabelDeletedAtLike   = "d3" // like-match of DeletedAt
	LockMetaIndexLabelDeletedAtEqual  = "d4" // perfect-match of DeletedAt
	LockMetaIndexLabelDeletedByEqual  = "d8" // perfect-match of DeletedBy
	LockMetaIndexLabelDeletedByLike   = "d7" // like-match of DeletedBy
	LockMetaIndexLabelDeletedByPrefix = "d5" // prefix-match of DeletedBy
	LockMetaIndexLabelDeletedBySuffix = "d6" // suffix-match of DeletedBy
	LockMetaIndexLabelVersionPrefix   = "v1" // prefix-match of Version
	LockMetaIndexLabelVersionSuffix   = "v2" // suffix-match of Version
	LockMetaIndexLabelVersionLike     = "v3" // like-match of Version
	LockMetaIndexLabelVersionEqual    = "v4" // perfect-match of Version
)
View Source
const (
	TaskIndexLabelDescEqual        = "d4"  // perfect-match of Desc
	TaskIndexLabelDescLike         = "d3"  // like-match of Desc
	TaskIndexLabelDescPrefix       = "d1"  // prefix-match of Desc
	TaskIndexLabelDescSuffix       = "d2"  // suffix-match of Desc
	TaskIndexLabelCreatedPrefix    = "c1"  // prefix-match of Created
	TaskIndexLabelCreatedSuffix    = "c2"  // suffix-match of Created
	TaskIndexLabelCreatedLike      = "c3"  // like-match of Created
	TaskIndexLabelCreatedEqual     = "c4"  // perfect-match of Created
	TaskIndexLabelDonePrefix       = "d5"  // prefix-match of Done
	TaskIndexLabelDoneSuffix       = "d6"  // suffix-match of Done
	TaskIndexLabelDoneLike         = "d7"  // like-match of Done
	TaskIndexLabelDoneEqual        = "d8"  // perfect-match of Done
	TaskIndexLabelDone2Prefix      = "d9"  // prefix-match of Done2
	TaskIndexLabelDone2Suffix      = "do1" // suffix-match of Done2
	TaskIndexLabelDone2Like        = "do2" // like-match of Done2
	TaskIndexLabelDone2Equal       = "do3" // perfect-match of Done2
	TaskIndexLabelCountPrefix      = "c5"  // prefix-match of Count
	TaskIndexLabelCountSuffix      = "c6"  // suffix-match of Count
	TaskIndexLabelCountLike        = "c7"  // like-match of Count
	TaskIndexLabelCountEqual       = "c8"  // perfect-match of Count
	TaskIndexLabelCount64Prefix    = "c9"  // prefix-match of Count64
	TaskIndexLabelCount64Suffix    = "co1" // suffix-match of Count64
	TaskIndexLabelCount64Like      = "co2" // like-match of Count64
	TaskIndexLabelCount64Equal     = "co3" // perfect-match of Count64
	TaskIndexLabelNameListPrefix   = "n1"  // prefix-match of NameList
	TaskIndexLabelNameListSuffix   = "n2"  // suffix-match of NameList
	TaskIndexLabelNameListLike     = "n3"  // like-match of NameList
	TaskIndexLabelNameListEqual    = "n4"  // perfect-match of NameList
	TaskIndexLabelProportionPrefix = "p1"  // prefix-match of Proportion
	TaskIndexLabelProportionSuffix = "p2"  // suffix-match of Proportion
	TaskIndexLabelProportionLike   = "p3"  // like-match of Proportion
	TaskIndexLabelProportionEqual  = "p4"  // perfect-match of Proportion
	TaskIndexLabelFlagPrefix       = "f1"  // prefix-match of Flag
	TaskIndexLabelFlagSuffix       = "f2"  // suffix-match of Flag
	TaskIndexLabelFlagLike         = "f3"  // like-match of Flag
	TaskIndexLabelFlagEqual        = "f4"  // perfect-match of Flag
)

Variables

View Source
var (
	ErrAlreadyExists        = xerrors.New("already exists")
	ErrAlreadyDeleted       = xerrors.New("already been deleted")
	ErrNotFound             = xerrors.New("not found")
	ErrLogicallyDeletedData = xerrors.New("logically deleted data")
	ErrUniqueConstraint     = xerrors.New("unique constraint error")
	ErrNotAvailableCG       = xerrors.New("not available in collection groups")
	ErrVersionConflict      = xerrors.New("version conflict")
)

Functions

func IsSlice added in v1.1.4

func IsSlice(v interface{}) bool

IsSlice - slice judgment

func SetLastThreeToZero added in v1.1.4

func SetLastThreeToZero(t time.Time) time.Time

SetLastThreeToZero - set the last three digits to zero

Types

type Cursor added in v1.1.4

type Cursor struct {
	// contains filtered or unexported fields
}

Cursor - query cursor

type DeleteMode added in v1.1.4

type DeleteMode int

DeleteMode - delete mode

const (
	DeleteModeSoft DeleteMode = iota + 1 // logical delete mode
	DeleteModeHard                       // physical delete mode
)

type DeleteOption added in v1.1.4

type DeleteOption struct {
	Mode DeleteMode
}

DeleteOption - option to delete logically or physically default: physical deletion use `DeleteModeSoft` or `DeleteModeHard

type Filter added in v1.1.4

type Filter struct {
	FilterTypes []FilterType
	Value       interface{}
}

Filter - filters of extra indexer

type FilterType added in v1.1.4

type FilterType = int

FilterType - extra indexes filters type

const (
	FilterTypeAdd FilterType = 1 << iota
	FilterTypeAddPrefix
	FilterTypeAddSuffix
	FilterTypeAddBiunigrams
	FilterTypeAddSomething
)

type GetOption added in v1.1.4

type GetOption struct {
	IncludeSoftDeleted bool
}

GetOption - option to include logical deletion data

type Lock

type Lock struct {
	ID   string             `firestore:"-" firestore_key:"auto"`
	Text string             `firestore:"text"`
	Flag map[string]float64 `firestore:"flag"`
	Meta
}

Lock ID自動生成あり

type LockMeta

type LockMeta struct {
	ID   string             `firestore:"-" firestore_key:"auto"`
	Text string             `firestore:"text"`
	Flag map[string]float64 `firestore:"flag"`
	Meta
}

LockMeta ID自動生成あり

type LockMeta2

type LockMeta2 struct {
	ID   string             `firestore:"-" firestore_key:"auto"`
	Text string             `firestore:"text"`
	Flag map[string]float64 `firestore:"flag"`
	meta.AAAMeta
}

LockMeta2 ID自動生成あり

type LockMeta2Repository added in v1.1.4

type LockMeta2Repository interface {
	// Single
	Get(ctx context.Context, id string, opts ...GetOption) (*LockMeta2, error)
	GetWithDoc(ctx context.Context, doc *firestore.DocumentRef, opts ...GetOption) (*LockMeta2, error)
	Insert(ctx context.Context, subject *LockMeta2) (_ string, err error)
	Update(ctx context.Context, subject *LockMeta2) (err error)
	StrictUpdate(ctx context.Context, id string, param *LockMeta2UpdateParam, opts ...firestore.Precondition) error
	Delete(ctx context.Context, subject *LockMeta2, opts ...DeleteOption) (err error)
	DeleteByID(ctx context.Context, id string, opts ...DeleteOption) (err error)
	// Multiple
	GetMulti(ctx context.Context, ids []string, opts ...GetOption) ([]*LockMeta2, error)
	InsertMulti(ctx context.Context, subjects []*LockMeta2) (_ []string, er error)
	UpdateMulti(ctx context.Context, subjects []*LockMeta2) (er error)
	DeleteMulti(ctx context.Context, subjects []*LockMeta2, opts ...DeleteOption) (er error)
	DeleteMultiByIDs(ctx context.Context, ids []string, opts ...DeleteOption) (er error)
	// Single(Transaction)
	GetWithTx(tx *firestore.Transaction, id string, opts ...GetOption) (*LockMeta2, error)
	GetWithDocWithTx(tx *firestore.Transaction, doc *firestore.DocumentRef, opts ...GetOption) (*LockMeta2, error)
	InsertWithTx(ctx context.Context, tx *firestore.Transaction, subject *LockMeta2) (_ string, err error)
	UpdateWithTx(ctx context.Context, tx *firestore.Transaction, subject *LockMeta2) (err error)
	StrictUpdateWithTx(tx *firestore.Transaction, id string, param *LockMeta2UpdateParam, opts ...firestore.Precondition) error
	DeleteWithTx(ctx context.Context, tx *firestore.Transaction, subject *LockMeta2, opts ...DeleteOption) (err error)
	DeleteByIDWithTx(ctx context.Context, tx *firestore.Transaction, id string, opts ...DeleteOption) (err error)
	// Multiple(Transaction)
	GetMultiWithTx(tx *firestore.Transaction, ids []string, opts ...GetOption) ([]*LockMeta2, error)
	InsertMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*LockMeta2) (_ []string, er error)
	UpdateMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*LockMeta2) (er error)
	DeleteMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*LockMeta2, opts ...DeleteOption) (er error)
	DeleteMultiByIDsWithTx(ctx context.Context, tx *firestore.Transaction, ids []string, opts ...DeleteOption) (er error)
	// Search
	Search(ctx context.Context, param *LockMeta2SearchParam, q *firestore.Query) ([]*LockMeta2, error)
	SearchWithTx(tx *firestore.Transaction, param *LockMeta2SearchParam, q *firestore.Query) ([]*LockMeta2, error)
	// misc
	GetCollection() *firestore.CollectionRef
	GetCollectionName() string
	GetDocRef(id string) *firestore.DocumentRef
	RunInTransaction() func(ctx context.Context, f func(context.Context, *firestore.Transaction) error, opts ...firestore.TransactionOption) (err error)
}

LockMeta2Repository - Repository of LockMeta2

func NewLockMeta2Repository added in v1.1.4

func NewLockMeta2Repository(firestoreClient *firestore.Client, middleware ...LockMeta2RepositoryMiddleware) LockMeta2Repository

NewLockMeta2Repository - constructor

type LockMeta2RepositoryMiddleware added in v1.1.4

type LockMeta2RepositoryMiddleware interface {
	BeforeInsert(ctx context.Context, subject *LockMeta2) (bool, error)
	BeforeUpdate(ctx context.Context, old, subject *LockMeta2) (bool, error)
	BeforeDelete(ctx context.Context, subject *LockMeta2, opts ...DeleteOption) (bool, error)
	BeforeDeleteByID(ctx context.Context, ids []string, opts ...DeleteOption) (bool, error)
}

LockMeta2RepositoryMiddleware - middleware of LockMeta2Repository

type LockMeta2SearchParam added in v1.1.4

type LockMeta2SearchParam struct {
	Text      *QueryChainer
	Flag      *QueryChainer
	CreatedAt *QueryChainer
	CreatedBy *QueryChainer
	UpdatedAt *QueryChainer
	UpdatedBy *QueryChainer
	DeletedAt *QueryChainer
	DeletedBy *QueryChainer
	Version   *QueryChainer

	IncludeSoftDeleted bool
	CursorLimit        int
}

LockMeta2SearchParam - params for search

type LockMeta2UpdateParam added in v1.1.4

type LockMeta2UpdateParam struct {
	Text      interface{}
	Flag      interface{}
	CreatedAt interface{}
	CreatedBy interface{}
	UpdatedAt interface{}
	UpdatedBy interface{}
	DeletedAt interface{}
	DeletedBy interface{}
	Version   interface{}
}

LockMeta2UpdateParam - params for strict updates

type LockMetaRepository added in v1.1.4

type LockMetaRepository interface {
	// Single
	Get(ctx context.Context, id string, opts ...GetOption) (*LockMeta, error)
	GetWithDoc(ctx context.Context, doc *firestore.DocumentRef, opts ...GetOption) (*LockMeta, error)
	Insert(ctx context.Context, subject *LockMeta) (_ string, err error)
	Update(ctx context.Context, subject *LockMeta) (err error)
	StrictUpdate(ctx context.Context, id string, param *LockMetaUpdateParam, opts ...firestore.Precondition) error
	Delete(ctx context.Context, subject *LockMeta, opts ...DeleteOption) (err error)
	DeleteByID(ctx context.Context, id string, opts ...DeleteOption) (err error)
	// Multiple
	GetMulti(ctx context.Context, ids []string, opts ...GetOption) ([]*LockMeta, error)
	InsertMulti(ctx context.Context, subjects []*LockMeta) (_ []string, er error)
	UpdateMulti(ctx context.Context, subjects []*LockMeta) (er error)
	DeleteMulti(ctx context.Context, subjects []*LockMeta, opts ...DeleteOption) (er error)
	DeleteMultiByIDs(ctx context.Context, ids []string, opts ...DeleteOption) (er error)
	// Single(Transaction)
	GetWithTx(tx *firestore.Transaction, id string, opts ...GetOption) (*LockMeta, error)
	GetWithDocWithTx(tx *firestore.Transaction, doc *firestore.DocumentRef, opts ...GetOption) (*LockMeta, error)
	InsertWithTx(ctx context.Context, tx *firestore.Transaction, subject *LockMeta) (_ string, err error)
	UpdateWithTx(ctx context.Context, tx *firestore.Transaction, subject *LockMeta) (err error)
	StrictUpdateWithTx(tx *firestore.Transaction, id string, param *LockMetaUpdateParam, opts ...firestore.Precondition) error
	DeleteWithTx(ctx context.Context, tx *firestore.Transaction, subject *LockMeta, opts ...DeleteOption) (err error)
	DeleteByIDWithTx(ctx context.Context, tx *firestore.Transaction, id string, opts ...DeleteOption) (err error)
	// Multiple(Transaction)
	GetMultiWithTx(tx *firestore.Transaction, ids []string, opts ...GetOption) ([]*LockMeta, error)
	InsertMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*LockMeta) (_ []string, er error)
	UpdateMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*LockMeta) (er error)
	DeleteMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*LockMeta, opts ...DeleteOption) (er error)
	DeleteMultiByIDsWithTx(ctx context.Context, tx *firestore.Transaction, ids []string, opts ...DeleteOption) (er error)
	// Search
	Search(ctx context.Context, param *LockMetaSearchParam, q *firestore.Query) ([]*LockMeta, error)
	SearchWithTx(tx *firestore.Transaction, param *LockMetaSearchParam, q *firestore.Query) ([]*LockMeta, error)
	// misc
	GetCollection() *firestore.CollectionRef
	GetCollectionName() string
	GetDocRef(id string) *firestore.DocumentRef
	RunInTransaction() func(ctx context.Context, f func(context.Context, *firestore.Transaction) error, opts ...firestore.TransactionOption) (err error)
}

LockMetaRepository - Repository of LockMeta

func NewLockMetaRepository added in v1.1.4

func NewLockMetaRepository(firestoreClient *firestore.Client, middleware ...LockMetaRepositoryMiddleware) LockMetaRepository

NewLockMetaRepository - constructor

type LockMetaRepositoryMiddleware added in v1.1.4

type LockMetaRepositoryMiddleware interface {
	BeforeInsert(ctx context.Context, subject *LockMeta) (bool, error)
	BeforeUpdate(ctx context.Context, old, subject *LockMeta) (bool, error)
	BeforeDelete(ctx context.Context, subject *LockMeta, opts ...DeleteOption) (bool, error)
	BeforeDeleteByID(ctx context.Context, ids []string, opts ...DeleteOption) (bool, error)
}

LockMetaRepositoryMiddleware - middleware of LockMetaRepository

type LockMetaSearchParam added in v1.1.4

type LockMetaSearchParam struct {
	Text      *QueryChainer
	Flag      *QueryChainer
	CreatedAt *QueryChainer
	CreatedBy *QueryChainer
	UpdatedAt *QueryChainer
	UpdatedBy *QueryChainer
	DeletedAt *QueryChainer
	DeletedBy *QueryChainer
	Version   *QueryChainer

	IncludeSoftDeleted bool
	CursorLimit        int
}

LockMetaSearchParam - params for search

type LockMetaUpdateParam added in v1.1.4

type LockMetaUpdateParam struct {
	Text      interface{}
	Flag      interface{}
	CreatedAt interface{}
	CreatedBy interface{}
	UpdatedAt interface{}
	UpdatedBy interface{}
	DeletedAt interface{}
	DeletedBy interface{}
	Version   interface{}
}

LockMetaUpdateParam - params for strict updates

type LockRepository added in v1.1.4

type LockRepository interface {
	// Single
	Get(ctx context.Context, id string, opts ...GetOption) (*Lock, error)
	GetWithDoc(ctx context.Context, doc *firestore.DocumentRef, opts ...GetOption) (*Lock, error)
	Insert(ctx context.Context, subject *Lock) (_ string, err error)
	Update(ctx context.Context, subject *Lock) (err error)
	StrictUpdate(ctx context.Context, id string, param *LockUpdateParam, opts ...firestore.Precondition) error
	Delete(ctx context.Context, subject *Lock, opts ...DeleteOption) (err error)
	DeleteByID(ctx context.Context, id string, opts ...DeleteOption) (err error)
	// Multiple
	GetMulti(ctx context.Context, ids []string, opts ...GetOption) ([]*Lock, error)
	InsertMulti(ctx context.Context, subjects []*Lock) (_ []string, er error)
	UpdateMulti(ctx context.Context, subjects []*Lock) (er error)
	DeleteMulti(ctx context.Context, subjects []*Lock, opts ...DeleteOption) (er error)
	DeleteMultiByIDs(ctx context.Context, ids []string, opts ...DeleteOption) (er error)
	// Single(Transaction)
	GetWithTx(tx *firestore.Transaction, id string, opts ...GetOption) (*Lock, error)
	GetWithDocWithTx(tx *firestore.Transaction, doc *firestore.DocumentRef, opts ...GetOption) (*Lock, error)
	InsertWithTx(ctx context.Context, tx *firestore.Transaction, subject *Lock) (_ string, err error)
	UpdateWithTx(ctx context.Context, tx *firestore.Transaction, subject *Lock) (err error)
	StrictUpdateWithTx(tx *firestore.Transaction, id string, param *LockUpdateParam, opts ...firestore.Precondition) error
	DeleteWithTx(ctx context.Context, tx *firestore.Transaction, subject *Lock, opts ...DeleteOption) (err error)
	DeleteByIDWithTx(ctx context.Context, tx *firestore.Transaction, id string, opts ...DeleteOption) (err error)
	// Multiple(Transaction)
	GetMultiWithTx(tx *firestore.Transaction, ids []string, opts ...GetOption) ([]*Lock, error)
	InsertMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*Lock) (_ []string, er error)
	UpdateMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*Lock) (er error)
	DeleteMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*Lock, opts ...DeleteOption) (er error)
	DeleteMultiByIDsWithTx(ctx context.Context, tx *firestore.Transaction, ids []string, opts ...DeleteOption) (er error)
	// Search
	Search(ctx context.Context, param *LockSearchParam, q *firestore.Query) ([]*Lock, error)
	SearchWithTx(tx *firestore.Transaction, param *LockSearchParam, q *firestore.Query) ([]*Lock, error)
	// misc
	GetCollection() *firestore.CollectionRef
	GetCollectionName() string
	GetDocRef(id string) *firestore.DocumentRef
	RunInTransaction() func(ctx context.Context, f func(context.Context, *firestore.Transaction) error, opts ...firestore.TransactionOption) (err error)
}

LockRepository - Repository of Lock

func NewLockRepository added in v1.1.4

func NewLockRepository(firestoreClient *firestore.Client, middleware ...LockRepositoryMiddleware) LockRepository

NewLockRepository - constructor

type LockRepositoryMiddleware added in v1.1.4

type LockRepositoryMiddleware interface {
	BeforeInsert(ctx context.Context, subject *Lock) (bool, error)
	BeforeUpdate(ctx context.Context, old, subject *Lock) (bool, error)
	BeforeDelete(ctx context.Context, subject *Lock, opts ...DeleteOption) (bool, error)
	BeforeDeleteByID(ctx context.Context, ids []string, opts ...DeleteOption) (bool, error)
}

LockRepositoryMiddleware - middleware of LockRepository

type LockSearchParam added in v1.1.4

type LockSearchParam struct {
	Text      *QueryChainer
	Flag      *QueryChainer
	CreatedAt *QueryChainer
	CreatedBy *QueryChainer
	UpdatedAt *QueryChainer
	UpdatedBy *QueryChainer
	DeletedAt *QueryChainer
	DeletedBy *QueryChainer
	Version   *QueryChainer

	IncludeSoftDeleted bool
	CursorLimit        int
}

LockSearchParam - params for search

type LockUpdateParam added in v1.1.4

type LockUpdateParam struct {
	Text      interface{}
	Flag      interface{}
	CreatedAt interface{}
	CreatedBy interface{}
	UpdatedAt interface{}
	UpdatedBy interface{}
	DeletedAt interface{}
	DeletedBy interface{}
	Version   interface{}
}

LockUpdateParam - params for strict updates

type Meta

type Meta struct {
	CreatedAt time.Time  `firestore:"createdAt"`
	CreatedBy string     `firestore:"createdBy"`
	UpdatedAt time.Time  `firestore:"updatedAt"`
	UpdatedBy string     `firestore:"updatedBy"`
	DeletedAt *time.Time `firestore:"deletedAt"`
	DeletedBy string     `firestore:"deletedBy"`
	Version   int        `firestore:"version"`
}

type MultiError added in v1.1.4

type MultiError interface {
	GetIndex() int
	GetError() error
	Error() string
}

MultiError - multi error interface

func NewMultiError added in v1.1.4

func NewMultiError(index int, err error) MultiError

NewMultiError - constructor

type MultiErrors added in v1.1.4

type MultiErrors []MultiError

MultiErrors - multi errors

func NewMultiErrors added in v1.1.4

func NewMultiErrors() MultiErrors

NewMultiErrors - constructor

func (MultiErrors) Error added in v1.1.4

func (errs MultiErrors) Error() string

Error - multi errors string

type OpType added in v1.1.4

type OpType = string

OpType - operator type

const (
	OpTypeEqual              OpType = "=="
	OpTypeNotEqual           OpType = "!="
	OpTypeLessThan           OpType = "<"
	OpTypeLessThanOrEqual    OpType = "<="
	OpTypeGreaterThan        OpType = ">"
	OpTypeGreaterThanOrEqual OpType = ">="
	OpTypeIn                 OpType = "in"
	OpTypeNotIn              OpType = "not-in"
	OpTypeArrayContains      OpType = "array-contains"
	OpTypeArrayContainsAny   OpType = "array-contains-any"
)

type Query added in v1.1.4

type Query struct {
	Operator OpType
	Value    interface{}
}

Query - query

func (*Query) IsSlice added in v1.1.4

func (q *Query) IsSlice() bool

IsSlice - slice judgment

type QueryBuilder added in v1.1.4

type QueryBuilder struct {
	// contains filtered or unexported fields
}

QueryBuilder - query builder

func NewQueryBuilder added in v1.1.4

func NewQueryBuilder(collection *firestore.CollectionRef) *QueryBuilder

NewQueryBuilder - constructor

func (*QueryBuilder) ArrayContains added in v1.1.4

func (qb *QueryBuilder) ArrayContains(path string, value interface{}) *QueryBuilder

ArrayContains - array filter ( `array-contains` )

func (*QueryBuilder) ArrayContainsAny added in v1.1.4

func (qb *QueryBuilder) ArrayContainsAny(path string, value interface{}) *QueryBuilder

ArrayContainsAny - array filter ( `array-contains-any` )

func (*QueryBuilder) Asc added in v1.1.4

func (qb *QueryBuilder) Asc(path string) *QueryBuilder

Asc - order

func (*QueryBuilder) Check added in v1.1.4

func (qb *QueryBuilder) Check() error

Check - condition check

func (*QueryBuilder) Desc added in v1.1.4

func (qb *QueryBuilder) Desc(path string) *QueryBuilder

Desc - order

func (*QueryBuilder) EndAt added in v1.1.4

func (qb *QueryBuilder) EndAt(docSnapshotOrFieldValues ...interface{}) *QueryBuilder

EndAt - end at

func (*QueryBuilder) EndBefore added in v1.1.4

func (qb *QueryBuilder) EndBefore(docSnapshotOrFieldValues ...interface{}) *QueryBuilder

EndBefore - end before

func (*QueryBuilder) Equal added in v1.1.4

func (qb *QueryBuilder) Equal(path string, value interface{}) *QueryBuilder

Equal - equality filter ( `==` )

func (*QueryBuilder) GreaterThan added in v1.1.4

func (qb *QueryBuilder) GreaterThan(path string, value interface{}) *QueryBuilder

GreaterThan - range filter ( `>` )

func (*QueryBuilder) GreaterThanOrEqual added in v1.1.4

func (qb *QueryBuilder) GreaterThanOrEqual(path string, value interface{}) *QueryBuilder

GreaterThanOrEqual - range filter ( `>=` )

func (*QueryBuilder) In added in v1.1.4

func (qb *QueryBuilder) In(path string, value interface{}) *QueryBuilder

In - array filter ( `in` )

func (*QueryBuilder) LessThan added in v1.1.4

func (qb *QueryBuilder) LessThan(path string, value interface{}) *QueryBuilder

LessThan - range filter ( `<` )

func (*QueryBuilder) LessThanOrEqual added in v1.1.4

func (qb *QueryBuilder) LessThanOrEqual(path string, value interface{}) *QueryBuilder

LessThanOrEqual - range filter ( `<=` )

func (*QueryBuilder) Limit added in v1.1.4

func (qb *QueryBuilder) Limit(limit int) *QueryBuilder

Limit - limit

func (*QueryBuilder) NotEqual added in v1.1.4

func (qb *QueryBuilder) NotEqual(path string, value interface{}) *QueryBuilder

NotEqual - inequality filter ( `!=` )

func (*QueryBuilder) NotIn added in v1.1.4

func (qb *QueryBuilder) NotIn(path string, value interface{}) *QueryBuilder

NotIn - array filter ( `not-in` )

func (*QueryBuilder) Query added in v1.1.4

func (qb *QueryBuilder) Query() *firestore.Query

Query - return firestore.Query

func (*QueryBuilder) StartAfter added in v1.1.4

func (qb *QueryBuilder) StartAfter(docSnapshotOrFieldValues ...interface{}) *QueryBuilder

StartAfter - start after

func (*QueryBuilder) StartAt added in v1.1.4

func (qb *QueryBuilder) StartAt(docSnapshotOrFieldValues ...interface{}) *QueryBuilder

StartAt - start at

type QueryChainer added in v1.1.4

type QueryChainer struct {
	QueryGroup       []*Query
	OrderByDirection firestore.Direction
	Filter           Filter
	// contains filtered or unexported fields
}

QueryChainer - query chainer

func NewQueryChainer added in v1.1.4

func NewQueryChainer() *QueryChainer

NewQueryChainer - constructor

func (*QueryChainer) ArrayContains added in v1.1.4

func (qc *QueryChainer) ArrayContains(v interface{}) *QueryChainer

ArrayContains - `array-contains`

func (*QueryChainer) ArrayContainsAny added in v1.1.4

func (qc *QueryChainer) ArrayContainsAny(v interface{}) *QueryChainer

ArrayContainsAny - `array-contains-any`

func (*QueryChainer) Asc added in v1.1.4

func (qc *QueryChainer) Asc() *QueryChainer

Asc - `Asc`

func (*QueryChainer) BuildCursorQuery added in v1.1.4

func (qc *QueryChainer) BuildCursorQuery(q firestore.Query) firestore.Query

BuildCursor - build query for cursor

func (*QueryChainer) Desc added in v1.1.4

func (qc *QueryChainer) Desc() *QueryChainer

Desc - `Desc`

func (*QueryChainer) EndAt added in v1.1.4

func (qc *QueryChainer) EndAt(v ...interface{}) *QueryChainer

EndAt - end at

func (*QueryChainer) EndBefore added in v1.1.4

func (qc *QueryChainer) EndBefore(v ...interface{}) *QueryChainer

EndBefore - end before

func (*QueryChainer) Equal added in v1.1.4

func (qc *QueryChainer) Equal(v interface{}) *QueryChainer

Equal - `==`

func (*QueryChainer) Error added in v1.1.4

func (qc *QueryChainer) Error() error

Error - error

func (*QueryChainer) Filters added in v1.1.4

func (qc *QueryChainer) Filters(v interface{}, filterTypes ...FilterType) *QueryChainer

Filters - using `xim`

func (*QueryChainer) GreaterThan added in v1.1.4

func (qc *QueryChainer) GreaterThan(v interface{}) *QueryChainer

GreaterThan - `>`

func (*QueryChainer) GreaterThanOrEqual added in v1.1.4

func (qc *QueryChainer) GreaterThanOrEqual(v interface{}) *QueryChainer

GreaterThanOrEqual - `>=`

func (*QueryChainer) In added in v1.1.4

func (qc *QueryChainer) In(v interface{}) *QueryChainer

In - `in`

func (*QueryChainer) LessThan added in v1.1.4

func (qc *QueryChainer) LessThan(v interface{}) *QueryChainer

LessThan - `<`

func (*QueryChainer) LessThanOrEqual added in v1.1.4

func (qc *QueryChainer) LessThanOrEqual(v interface{}) *QueryChainer

LessThanOrEqual - `<=`

func (*QueryChainer) NotEqual added in v1.1.4

func (qc *QueryChainer) NotEqual(v interface{}) *QueryChainer

NotEqual - `!=`

func (*QueryChainer) NotIn added in v1.1.4

func (qc *QueryChainer) NotIn(v interface{}) *QueryChainer

NotIn - `not-in`

func (*QueryChainer) StartAfter added in v1.1.4

func (qc *QueryChainer) StartAfter(v ...interface{}) *QueryChainer

StartAt - start after

func (*QueryChainer) StartAt added in v1.1.4

func (qc *QueryChainer) StartAt(v ...interface{}) *QueryChainer

StartAt - start at

type RollbackFunc added in v1.1.4

type RollbackFunc func(context.Context) error

RollbackFunc - rollback function

type Task

type Task struct {
	ID         string             `firestore:"-" firestore_key:"auto"`
	Desc       string             `firestore:"description" indexer:"e,p,s,l"`
	Created    time.Time          `firestore:"created"`
	Done       bool               `firestore:"done"`
	Done2      bool               `firestore:"done2"`
	Count      int                `firestore:"count"`
	Count64    int64              `firestore:"count64"`
	NameList   []string           `firestore:"nameList"`
	Proportion float64            `firestore:"proportion" indexer:"e"`
	Flag       map[string]float64 `firestore:"flag"`
	Indexes    map[string]bool    `firestore:"indexes"`
}

Task ID自動生成あり

type TaskRepository added in v1.1.4

type TaskRepository interface {
	// Single
	Get(ctx context.Context, id string, opts ...GetOption) (*Task, error)
	GetWithDoc(ctx context.Context, doc *firestore.DocumentRef, opts ...GetOption) (*Task, error)
	Insert(ctx context.Context, subject *Task) (_ string, err error)
	Update(ctx context.Context, subject *Task) (err error)
	StrictUpdate(ctx context.Context, id string, param *TaskUpdateParam, opts ...firestore.Precondition) error
	Delete(ctx context.Context, subject *Task, opts ...DeleteOption) (err error)
	DeleteByID(ctx context.Context, id string, opts ...DeleteOption) (err error)
	// Multiple
	GetMulti(ctx context.Context, ids []string, opts ...GetOption) ([]*Task, error)
	InsertMulti(ctx context.Context, subjects []*Task) (_ []string, er error)
	UpdateMulti(ctx context.Context, subjects []*Task) (er error)
	DeleteMulti(ctx context.Context, subjects []*Task, opts ...DeleteOption) (er error)
	DeleteMultiByIDs(ctx context.Context, ids []string, opts ...DeleteOption) (er error)
	// Single(Transaction)
	GetWithTx(tx *firestore.Transaction, id string, opts ...GetOption) (*Task, error)
	GetWithDocWithTx(tx *firestore.Transaction, doc *firestore.DocumentRef, opts ...GetOption) (*Task, error)
	InsertWithTx(ctx context.Context, tx *firestore.Transaction, subject *Task) (_ string, err error)
	UpdateWithTx(ctx context.Context, tx *firestore.Transaction, subject *Task) (err error)
	StrictUpdateWithTx(tx *firestore.Transaction, id string, param *TaskUpdateParam, opts ...firestore.Precondition) error
	DeleteWithTx(ctx context.Context, tx *firestore.Transaction, subject *Task, opts ...DeleteOption) (err error)
	DeleteByIDWithTx(ctx context.Context, tx *firestore.Transaction, id string, opts ...DeleteOption) (err error)
	// Multiple(Transaction)
	GetMultiWithTx(tx *firestore.Transaction, ids []string, opts ...GetOption) ([]*Task, error)
	InsertMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*Task) (_ []string, er error)
	UpdateMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*Task) (er error)
	DeleteMultiWithTx(ctx context.Context, tx *firestore.Transaction, subjects []*Task, opts ...DeleteOption) (er error)
	DeleteMultiByIDsWithTx(ctx context.Context, tx *firestore.Transaction, ids []string, opts ...DeleteOption) (er error)
	// Search
	Search(ctx context.Context, param *TaskSearchParam, q *firestore.Query) ([]*Task, error)
	SearchWithTx(tx *firestore.Transaction, param *TaskSearchParam, q *firestore.Query) ([]*Task, error)
	// misc
	GetCollection() *firestore.CollectionRef
	GetCollectionName() string
	GetDocRef(id string) *firestore.DocumentRef
	RunInTransaction() func(ctx context.Context, f func(context.Context, *firestore.Transaction) error, opts ...firestore.TransactionOption) (err error)
}

TaskRepository - Repository of Task

func NewTaskRepository added in v1.1.4

func NewTaskRepository(firestoreClient *firestore.Client, middleware ...TaskRepositoryMiddleware) TaskRepository

NewTaskRepository - constructor

type TaskRepositoryMiddleware added in v1.1.4

type TaskRepositoryMiddleware interface {
	BeforeInsert(ctx context.Context, subject *Task) (bool, error)
	BeforeUpdate(ctx context.Context, old, subject *Task) (bool, error)
	BeforeDelete(ctx context.Context, subject *Task, opts ...DeleteOption) (bool, error)
	BeforeDeleteByID(ctx context.Context, ids []string, opts ...DeleteOption) (bool, error)
}

TaskRepositoryMiddleware - middleware of TaskRepository

type TaskSearchParam added in v1.1.4

type TaskSearchParam struct {
	Desc       *QueryChainer
	Created    *QueryChainer
	Done       *QueryChainer
	Done2      *QueryChainer
	Count      *QueryChainer
	Count64    *QueryChainer
	NameList   *QueryChainer
	Proportion *QueryChainer
	Flag       *QueryChainer

	CursorLimit int
}

TaskSearchParam - params for search

type TaskUpdateParam added in v1.1.4

type TaskUpdateParam struct {
	Desc       interface{}
	Created    interface{}
	Done       interface{}
	Done2      interface{}
	Count      interface{}
	Count64    interface{}
	NameList   interface{}
	Proportion interface{}
	Flag       interface{}
}

TaskUpdateParam - params for strict updates

type Unique added in v1.1.4

type Unique struct {
	ID         string `firestore:"-"`
	Collection string
	Data       string
	Value      string
}

Unique - Collections for unique constraints

type UniqueMiddlewareKey added in v1.1.4

type UniqueMiddlewareKey struct{}

type UniqueRepositoryMiddleware added in v1.1.4

type UniqueRepositoryMiddleware interface {
	WrapError(ctx context.Context, err error, uniques []*Unique) error
}

UniqueRepositoryMiddleware - middleware

Notes

Bugs

  • there may be potential bugs

  • there may be potential bugs

  • there may be potential bugs

  • there may be potential bugs

Directories

Path Synopsis
Code generated by volcago.
Code generated by volcago.
mock/mock_lock_meta_gen
Package mock_model is a generated GoMock package.
Package mock_model is a generated GoMock package.
mock
mock_lock_gen
Package mock_model is a generated GoMock package.
Package mock_model is a generated GoMock package.
mock_lock_meta2_gen
Package mock_model is a generated GoMock package.
Package mock_model is a generated GoMock package.
mock_lock_meta_gen
Package mock_model is a generated GoMock package.
Package mock_model is a generated GoMock package.
mock_task_gen
Package mock_model is a generated GoMock package.
Package mock_model is a generated GoMock package.

Jump to

Keyboard shortcuts

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