Documentation ¶
Overview ¶
Package server はサーバーアプリの実装です。
Index ¶
Constants ¶
const (
// ProtectingCopyDefaultStructTag is the default tag name to test fields not to copy
ProtectingCopyDefaultStructTag = "protectfor"
)
Variables ¶
Functions ¶
func ProtectingBind ¶
ProtectingBind wraps binging functions such as echo.Context.Bind(), providing field protection.
func ProtectingCopy ¶
ProtectingCopy performs deepcopy excluding fields with the tag whose key is "protectfor" and value is specified with `protectFor`. dst and src must suffice one of followings: * src and dst are non-nil pointers of the same type. * src and dst are the non-nil map. * src and dst are the non-nil slice with the same length.
Types ¶
type Entity ¶
type Entity struct { ID int64 `json:"id" datastore:"-" goon:"id" protectfor:"update"` Name string `json:"name" datastore:",noindex"` ScheduledDate time.Time `json:"scheduledDate" datastore:",noindex"` CreatedAt time.Time `json:"createdAt" protectfor:"update"` }
Entity は適当なモデルです。
type ErrCopyTypeMismatch ¶
type ErrCopyTypeMismatch struct {
// contains filtered or unexported fields
}
ErrCopyTypeMismatch represents an error caused for type mismatching between source and destination.
func NewErrCopyTypeMismatch ¶
func NewErrCopyTypeMismatch(dType, sType reflect.Type) *ErrCopyTypeMismatch
NewErrCopyTypeMismatch creates a new ErrCopyTypeMismatch.
func (*ErrCopyTypeMismatch) Error ¶
func (e *ErrCopyTypeMismatch) Error() string
type ErrCopyValueInvalid ¶
type ErrCopyValueInvalid struct {
// contains filtered or unexported fields
}
ErrCopyValueInvalid represents a failure of copy caused for the source or the destination is invalid (e.g. is nil)
func (*ErrCopyValueInvalid) Error ¶
func (e *ErrCopyValueInvalid) Error() string
type ProtectingCopier ¶
type ProtectingCopier struct { // StructTag is the tag name to test fields not to copy. // If not specified, ProtectingCopyDefaultStructTag is used. StructTag string // ProtectFor is the tag value to test fields not to copy ProtectFor string }
ProtectingCopier is the configuration to perform protecting copy
func (*ProtectingCopier) Copy ¶
func (c *ProtectingCopier) Copy(dst, src interface{}) error
Copy performs deepcopy protecting fields specified with tag. dst and src must suffice one of followings: * src and dst are non-nil pointers of the same type. * src and dst are the non-nil map. * src and dst are the non-nil slice with the same length.