// itemFromUser attempts to encode the supplied user as an
// instance of `backend.Item` suitable for storage.
itemFromUser attempts to encode the supplied user as an
instance of `backend.Item` suitable for storage.
// itemFromUser attempts to encode the supplied user as an // instance of ` backend . Item ` suitable for storage .
func itemFromUser(user services.User) (*backend.Item, error) {
	if err := user.Check(); err != nil {
		return nil, trace.Wrap(err)
	}
	value, err := services.GetUserMarshaler().MarshalUser(user)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	item := &backend.Item{
		Key:     backend.Key(webPrefix, usersPrefix, user.GetName(), paramsPrefix),
		Value:   value,
		Expires: user.Expiry(),
		ID:      user.GetResourceID(),
	}
	return item, nil
}
func itemFromUser ( user services . User ) ( * backend . Item , error ) { if err := user . Check ( ) ; err != nil { return nil , trace . Wrap ( err ) } value , err := services . GetUserMarshaler ( ) . MarshalUser ( user ) if err != nil { return nil , trace . Wrap ( err ) } item := & backend . Item { Key : backend . Key ( webPrefix , usersPrefix , user . GetName ( ) , paramsPrefix ) , Value : value , Expires : user . Expiry ( ) , ID : user . GetResourceID ( ) , } return item , nil }
itemFromUser attempts to encode the supplied user as an
instance of `backend.Item` suitable for storage.
itemFromUser attempts to encode the supplied user as an instance of ` backend . Item ` suitable for storage .