mock.ExpectExec(`INSERT INTO Products \(model, company, price\) values \('\$1', \$2, \$3\)`).
WithArgs(tt.args.model, tt.args.company, tt.args.price).
WillReturnResult(sqlmock.NewResult(1, 1))
package main
import (
"fmt"
"unsafe"
)
type S1 struct {
f1 int
}
func main() {
s1 := S1{}
s2 := struct{}{}
fmt.Printf("s1 size: %v\n", unsafe.Sizeof(s1))
fmt.Printf("s2 size: %v\n", unsafe.Sizeof(s2))
}
s1 size: 8
s2 size: 0
go ...
.{start-process go ... }
<?php
\Bitrix\Main\EventManager::getInstance()->addEventHandler(
'sale',
'OnSaleAdminOrderList',
'OnSaleAdminOrderListHandler'
);
function OnSaleAdminOrderListHandler(\Bitrix\Main\Event $event)
{
$getListParams = $event->getParameters();
$reailManagerGroupId = 1; //ID группы менеджеров розницы
$wholesaleManagerGroupId = 2; //ID группы менеджеров оптовиков
$optUserGroup = 3; //ID группы оптовых покупателей
$reatilUserGroup = 4; //ID группы розничных покупателей
global $USER;
$userGroups = \CUser::GetUserGroup($USER);
if (in_array($reailManagerGroupId, $userGroups)) {
$getListParams["filter"]["USER_GROUP.GROUP_ID"] = $reatilUserGroup;
} else if(in_array($wholesaleManagerGroupId, $userGroups)) {
$getListParams["filter"]["USER_GROUP.GROUP_ID"] = $optUserGroup;
}
$result = new \Bitrix\Main\EventResult(\Bitrix\Main\EventResult::SUCCESS, $getListParams);
return $result;
}
\CAgent::AddAgent( "\\Your\\Module\\SuperClass::superAgent();", "your.module", "N", 10 * 24 * 3600, "", "Y");
\CAgent::RemoveModuleAgents("your.module");