Documentation
¶
Overview ¶
Example
func SomeEndpoint(ctx context.COntext, req SomeRequest) error {
// validation
datastore.Lock(req.Key)
defer datastore.Unlock(req.Key)
tx := transaction.Begin()
defer tx.Rollback()
// API Process
tx.Done()
return nil
}
Index ¶
- func DefaultErrorMessage(err error) string
- func IsNotFound(err error) bool
- type Datastore
- type NotFound
- type NotFoundError
- type Test
- func (*Test) Descriptor() ([]byte, []int)
- func (m *Test) GetName() string
- func (*Test) ProtoMessage()
- func (m *Test) Reset()
- func (m *Test) String() string
- func (m *Test) XXX_DiscardUnknown()
- func (m *Test) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Test) XXX_Merge(src proto.Message)
- func (m *Test) XXX_Size() int
- func (m *Test) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultErrorMessage ¶
func IsNotFound ¶
Types ¶
type Datastore ¶
type Datastore interface {
AddPrefix(prefix string) Datastore
List(f func(length int) []proto.Message) error
// if result is empty, set pb as nil.
Get(key string, pb proto.Message) error
// update process requires locking in advance
Apply(key string, pb proto.Message) error
Delete(key string) error
Lock(key string) bool
Unlock(key string) bool
IsLocked(key string) bool
}
type NotFound ¶
type NotFound struct {
// contains filtered or unexported fields
}
func NewNotFound ¶
func (NotFound) IsNotFound ¶
type NotFoundError ¶
type Test ¶
type Test struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*Test) Descriptor ¶
func (*Test) ProtoMessage ¶
func (*Test) ProtoMessage()
func (*Test) XXX_DiscardUnknown ¶
func (m *Test) XXX_DiscardUnknown()
func (*Test) XXX_Unmarshal ¶
Click to show internal directories.
Click to hide internal directories.