コード例 #1
0
ファイル: cleaners.go プロジェクト: jlouis/go-watcher
func CleanCatalogList(
	db db.Connector,
	in *event.Event) (out clean.Catalog_list, err Errors) {

	out = clean.Catalog_list{
		Api_env:                  in.ApiEnv(),
		App_id:                   in.App_id.Value,
		App_groups:               in.AppGroups(db),
		Catalogs:                 in.Catalogs.GetArray(),
		Client_addr:              in.Ipv4Ipv6(in.IP),
		Client_app_version:       in.ApiAppVersion(),
		Client_user_agent:        in.User_agent,
		Dealers:                  in.GetDealers(),
		Is_archive_user:          in.Is_archive_user.Value,
		Is_dealer_admin:          in.Is_Dealer_admin.Value,
		Is_user_defined_location: in.Location.GeoCoded(),
		Is_uuid_ephemeral:        in.Is_uuid_ephemeral.Value, Query_string: in.Query_string,
		Limit:             in.Limit,
		Offset:            in.Offset,
		Request_geohash:   in.Geohash(),
		Request_latitude:  in.Latitude(),
		Request_longitude: in.Longitude(),
		Request_radius:    in.Location.ReqRadius,
		Server_addr:       in.Ipv4Ipv6(in.Server_ip),
		Stores:            in.Stores.GetArray(),
		TimeRange:         in.Times.Range,
		Timestamp:         in.Times.Timestamp(),
		Type:              in.Type(),
		Typeof:            in.Typeof.Value,
		User_id:           in.User.Id.Value,
		Uuid:              in.User.Uuid.Value,
	}
	err = eventChecker(in, out)
	return out, err
}
コード例 #2
0
ファイル: cleaners.go プロジェクト: jlouis/go-watcher
// NOTE recent events have dealer_id instead of dealer
func CleanDealerView(
	db db.Connector,
	in *event.Event) (out clean.Dealer_view, err Errors) {
	out = clean.Dealer_view{
		Api_env:                  in.ApiEnv(),
		App_id:                   in.App_id.Value,
		App_groups:               in.AppGroups(db),
		Client_addr:              in.Ipv4Ipv6(in.IP),
		Client_app_version:       in.ApiAppVersion(),
		Client_user_agent:        in.User_agent,
		Dealer_id:                in.Dealer.Value,
		Is_archive_user:          in.Is_archive_user.Value,
		Is_dealer_admin:          in.Is_Dealer_admin.Value,
		Is_user_defined_location: in.Location.GeoCoded(),
		Is_uuid_ephemeral:        in.Is_uuid_ephemeral.Value,
		Query_string:             in.Query_string,
		Request_geohash:          in.Geohash(),
		Request_latitude:         in.Latitude(),
		Request_longitude:        in.Longitude(),
		Request_radius:           in.Location.ReqRadius,
		Server_addr:              in.Ipv4Ipv6(in.Server_ip),
		Timestamp:                in.Times.Timestamp(),
		Type:                     in.Type(),
		User_id:                  in.User.Id.Value,
		Uuid:                     in.User.Uuid.Value,
	}
	err = eventChecker(in, out)
	return out, err
}
コード例 #3
0
ファイル: cleaners.go プロジェクト: jlouis/go-watcher
func CleanShopShareAdd(
	db db.Connector,
	in *event.Event) (out clean.Shoppingshare_add, err Errors) {
	out = clean.Shoppingshare_add{
		Api_Build:                in.Api_build,
		Api_Version:              in.Api,
		Api_env:                  in.ApiEnv(),
		App_id:                   in.App_id.Value,
		App_groups:               in.AppGroups(db),
		Client_addr:              in.Ipv4Ipv6(in.IP),
		Client_app_version:       in.ApiAppVersion(),
		Client_user_agent:        in.User_agent,
		Is_user_defined_location: in.Location.GeoCoded(),
		Is_Dealer_admin:          in.Is_Dealer_admin.Value,
		Is_archive_user:          in.Is_archive_user.Value,
		Is_uuid_ephemeral:        in.Is_uuid_ephemeral.Value,
		Query_string:             in.Query_string,
		Request_geohash:          in.Geohash(),
		Request_latitude:         in.Latitude(),
		Request_longitude:        in.Longitude(),
		Server_addr:              in.Ipv4Ipv6(in.Server_ip),
		Shopping_list:            in.Shop_list.Value,
		Timestamp:                in.Times.Timestamp(),
		Type:                     in.Type(),
		User_id:                  in.User.Id.Value,
		Uuid:                     in.Uuid.Value,
	}
	err = eventChecker(in, out)
	return out, err
}
コード例 #4
0
ファイル: cleaners.go プロジェクト: jlouis/go-watcher
/*
  CleanScopeAciton converts the input go struct containing the raw but  with
  surely  correct types into the data we really want to keep Conversion errors
  hare logged inside each conversion action once the event is cleaned is
  checked for fatal missing fields
*/
func CleanOfferView(
	db db.Connector,
	in *event.Event) (out clean.Offer_View, err Errors) {

	out = clean.Offer_View{
		Api_Build:                in.Api_build,
		Api_Version:              in.Api,
		Api_env:                  in.ApiEnv(),
		App_id:                   in.App_id.Value,
		App_groups:               in.AppGroups(db),
		Catalog_id:               in.GetCatalogId(db),
		Client_addr:              in.Ipv4Ipv6(in.IP),
		Client_app_version:       in.ApiAppVersion(),
		Client_user_agent:        in.User_agent,
		Currency:                 event.CheckCurrency(in.Currency),
		Dealer_id:                in.Dealer.Value,
		Expires:                  in.Expires(db),
		Is_archive_user:          in.Is_archive_user.Value,
		Is_dealer_admin:          in.Is_Dealer_admin.Value,
		Is_user_defined_location: in.Location.GeoCoded(),
		Is_uuid_ephemeral:        in.Is_uuid_ephemeral.Value,
		Query_string:             in.Query_string,
		Offer_id:                 in.Offer.Value,
		Price:                    in.GetPrice(db),
		Publish:                  in.PublishTimeStamp(db),
		Request_geohash:          in.Geohash(),
		Request_latitude:         in.Latitude(),
		Request_longitude:        in.Longitude(),
		Request_radius:           in.Location.ReqRadius,
		Run_from:                 in.RunFrom(db),
		Server_addr:              in.Ipv4Ipv6(in.Server_ip),
		Timestamp:                in.Times.Timestamp(),
		Type:                     in.Type(),
		User_birth_year:          in.GetByear(db),
		User_gender:              in.GetGender(db),
		User_id:                  in.User.Id.Value,
		Uuid:                     in.User.Uuid.Value,
	}
	err = eventChecker(in, out)
	return out, err
}
コード例 #5
0
ファイル: cleaners.go プロジェクト: jlouis/go-watcher
func CleanCatalogPageview(
	db db.Connector,
	in *event.Event) (out clean.Catalog_pageview, err Errors) {

	out = clean.Catalog_pageview{
		Api_Build:                in.Api_build,
		Api_Version:              in.Api,
		Api_env:                  in.ApiEnv(),
		App_id:                   in.App_id.Value,
		App_groups:               in.AppGroups(db),
		Catalog_id:               in.Catalog.Value,
		Client_addr:              in.Ipv4Ipv6(in.IP),
		Client_app_version:       in.ApiAppVersion(),
		Client_user_agent:        in.User_agent,
		Dealer_id:                in.Dealer.Value,
		Duration:                 in.UDuration(),
		Expires:                  in.Expires(db),
		Is_archive_user:          in.Is_archive_user.Value,
		Is_dealer_admin:          in.Is_Dealer_admin.Value,
		Is_user_defined_location: in.Location.GeoCoded(),
		Is_uuid_ephemeral:        in.Is_uuid_ephemeral.Value,
		Orientation:              in.Orientation.Value,
		Pages:                    in.Pages.GetArray(),
		Query_string:             in.Query_string,
		Publish:                  in.PublishTimeStamp(db),
		Request_geohash:          in.Geohash(),
		Request_latitude:         in.Latitude(),
		Request_longitude:        in.Longitude(),
		Request_radius:           in.Location.ReqRadius,
		Run_from:                 in.RunFrom(db),
		Server_addr:              in.Ipv4Ipv6(in.Server_ip),
		Timestamp:                in.Times.Timestamp(),
		Type:                     in.Type(),
		User_id:                  in.User.Id.Value,
		Uuid:                     in.User.Uuid.Value,
		View_session:             in.View_session.Value,
	}
	err = eventChecker(in, out)
	return out, err
}
コード例 #6
0
ファイル: cleaners.go プロジェクト: jlouis/go-watcher
func CleanOfferSearch(
	db db.Connector,
	in *event.Event) (out clean.Offer_Search, err Errors) {

	out = clean.Offer_Search{
		Api_Build:                in.Api_build,
		Api_Version:              in.Api,
		Api_env:                  in.ApiEnv(),
		App_id:                   in.App_id.Value,
		Client_addr:              in.Ipv4Ipv6(in.IP),
		App_groups:               in.AppGroups(db),
		Client_app_version:       in.ApiAppVersion(),
		Client_user_agent:        in.User_agent,
		Dealers:                  in.GetDealers(),
		Is_archive_user:          in.Is_archive_user.Value,
		Is_dealer_admin:          in.Is_Dealer_admin.Value,
		Is_user_defined_location: in.Location.GeoCoded(),
		Is_uuid_ephemeral:        in.Is_uuid_ephemeral.Value,
		Limit:                    in.Limit,
		Offers:                   in.Offers.GetArray(),
		Offset:                   in.Offset,
		Query:                    in.Query.Value,
		Query_string:             in.Query_string,
		Request_geohash:          in.Geohash(),
		Request_latitude:         in.Latitude(),
		Request_longitude:        in.Longitude(),
		Request_radius:           in.Location.ReqRadius,
		Results:                  in.Results.Value,
		Server_addr:              in.Ipv4Ipv6(in.Server_ip),
		Stores:                   in.Stores.GetArray(),
		Timestamp:                in.Times.Timestamp(),
		Type:                     in.Type(),
		User_birth_year:          in.GetByear(db),
		User_gender:              in.GetGender(db),
		User_id:                  in.User.Id.Value,
		Uuid:                     in.User.Uuid.Value,
	}
	err = eventChecker(in, out)
	return out, err
}
コード例 #7
0
ファイル: cleaners.go プロジェクト: jlouis/go-watcher
func CleanShopItemList(
	db db.Connector,
	in *event.Event) (out clean.Shoppingitem_list, err Errors) {
	out = clean.Shoppingitem_list{
		App_id:                   in.App_id.Value,
		App_groups:               in.AppGroups(db),
		Client_addr:              in.Ipv4Ipv6(in.IP),
		Is_user_defined_location: in.Location.GeoCoded(),
		Is_Owner:                 in.Is_owner,
		Request_geohash:          in.Geohash(),
		Request_latitude:         in.Latitude(),
		Request_longitude:        in.Longitude(),
		Server_addr:              in.Ipv4Ipv6(in.Server_ip),
		Shopping_list:            in.Shop_list.Value,
		Timestamp:                in.Times.Timestamp(),
		Type:                     in.Type(),
		User_id:                  in.User.Id.Value,
		Uuid:                     in.User.Uuid.Value,
	}
	err = eventChecker(in, out)
	return out, err
}